Today just good to do a font shadow effect, feeling with the effect of the shadow of the three-dimensional full ah! Wrote a simple demo to share with you!
The main is the following four properties
Android:shadowcolor the color of the shadow
ANDROID:SHADOWDX The horizontal shadow, whose value is negative to the left and positive to the right
Android:shadowdy the vertical direction, the negative value is left, positive is the right
Android:shadowradius radius of the shadow
The code is as follows:
copy content to clipboardCode:<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Xmlns:tools= "Http://schemas.android.com/tools"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:orientation= "Vertical" >
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:shadowcolor= "#40000000"
android:shadowdx= "0"
Android:shadowdy= "8"
android:shadowradius= "1"
Android:layout_margin= "20dip"
android:text= "Bottom Shadow effect"
Android:textsize= "20sp"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:shadowcolor= "#40000000"
android:shadowdx= "0"
Android:shadowdy= "-5"
android:shadowradius= "1"
Android:layout_margin= "20dip"
android:text= "Top Shadow"
Android:textsize= "20sp"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:shadowcolor= "#40000000"
android:shadowdx= "-5"
android:shadowdy= "0"
android:shadowradius= "1"
Android:layout_margin= "20dip"
Android:text= "Left Shadow"
Android:textsize= "20sp"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:shadowcolor= "#40000000"
android:shadowdx= "5"
android:shadowdy= "0"
android:shadowradius= "1"
Android:layout_margin= "20dip"
Android:text= "Right Shadow"
Android:textsize= "20sp"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:shadowcolor= "#40000000"
android:shadowdx= "5"
Android:shadowdy= "5"
android:shadowradius= "1"
Android:layout_margin= "20dip"
Android:text= "lower Right Side Shadow"
Android:textsize= "20sp"/>
</LinearLayout>
As follows:
Android font Shadow effect