1. Set the shadow font of Android
<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="10"/>
Android: shadowcolor shadow color
Android: horizontal offset of shadowdx shadow
Android: vertical offset of shadowdy shadow
Android: shadowradius shadow range
To unify the style and reuse the code, we can usually extract the style into the style. xml file.
<?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>
<Textview style = "@ style/textstyle" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" Android: text = "Font Style" Android: textsize = "30sp" Android: textstyle = "bold"/>