Android text Shadow effect settings

Source: Internet
Author: User

<textview  android:id= "@+id/tvtext1"   android:layout_width= "wrap_content"   android:layout_height= " Wrap_content "   android:text=" Text1 "   android:textsize=" 30sp "   android:textstyle=" bold "   Android: Textcolor= "#FFFFFF"   android:shadowcolor= "#ff0000ff"  android:shadowdx= "5"  android:shadowdy= "5"       android:shadowradius= "Ten"/>  

  

Android:shadowcolor Shadow Color

ANDROID:SHADOWDX Horizontal offset of shadow

Android:shadowdy Vertical offset of shadow

Android:shadowradius Range of Shadows

In order to unify style and code reuse, this style can usually be extracted into the Style.xml file.

<textview        style= "@style/textstyle"        android:layout_width= "fill_parent" android:layout_height= "        Wrap_content "        android:text=" font style "        android:textsize=" 30sp "        android:textstyle=" bold "/>

The reference to this style can be achieved.

<?xml version= "1.0" encoding= "Utf-8"?>  <resources>  <style name= "TextStyle" >  < Item Name= "Android:shadowcolor" > #ff0000ff </item>  <item name= "Android:shadowradius" >10</ item>  <item name= "ANDROID:SHADOWDX" >5</item>  <item name= "Android:shadowdy" >5</ item>  </style>  </resources>  

For Android text shading, there are four properties that can be set:

Android:shadowcolor: Shadow Color

ANDROID:SHADOWDX: Shadow X-Direction shift

Android:shadowdy: Shadow y-direction shift

Android:shadowradius: Radius of Shadow

Note: The radius of the shadow must be set to 0 without effect.

The following changes the X displacement:

Android:shadowcolor= "#ff000000" (first two bits for transparency)

android:shadowdx= "2"

android:shadowdy= "0"

android:shadowradius= "1"

Effect (right is positive):

The following changes the Y displacement:

Android:textcolor= "#979790"

Android:shadowcolor= "#ff000000"

android:shadowdx= "0"

Android:shadowdy= "2"

android:shadowradius= "1"

Effect (positive down):

Change the radius below:

android:shadowdx= "1"

android:shadowdy= "1"

android:shadowradius= "1"

Android text Shadow effect settings

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.