<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