Display text shadow in Android textview

Source: Internet
Author: User

The textview control has a method to control the addition of shadows:

Mtextview. setshadowlayer (10f, 11f, 5f, color. Yellow); the first parameter is The Blur radius, and the greater the Blur. The second parameter is the X horizontal distance from the shadow text. The third parameter is the y horizontal distance from the shadow text. The fourth parameter is the shadow color.

 

The second method is to separate the style of the textview control into a. xml file for addition.

Res/values/styles. xml

<? XML version = "1.0" encoding = "UTF-8"?> <Resources> <style name = "audiofileinfooverlaytext"> <item name = "Android: paddingleft"> 4px </item> <item name = "Android: paddingbottom "> 4px </item> <item name =" Android: textcolor "> # f1f1f1 </item> <item name =" Android: textsize "> 60sp </item> <item name =" Android: shadowcolor "> # 4d4d4d </item> <item name =" Android: shadowdx "> 0 </item> <item name =" Android: shadowdy ">-3 </item> <item name =" Android: shadowradius "> 3 </item> </style> </resources>

Res/layout/Main. xml

 
<Textview Android: Id = "@ + ID/tvtest" style = "@ style/audiofileinfooverlaytext" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content"/>

Both methods can be implemented.

Note: QQ technology exchange group: add one if you are interested in 108614806.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.