字体阴影需要四个相关参数:
1. android:shadowColor:阴影的颜色
2. android:shadowDx:水平方向上的偏移量
3. android:shadowDy:垂直方向上的偏移量
4. Android:shadowRadius:是阴影的的半径大少
5. 使用 textview的4个属性来实现:
android:shadowColor 阴影颜色
android:shadowDx 阴影的水平偏移量
android:shadowDy 阴影的垂直偏移量
android:shadowRadius 阴影的范围
阴影效果
复制代码
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:shadowColor="#FF000000"
android:shadowDx="5"
android:shadowDy="5"
android:shadowRadius="3"
android:text="阴影效果"
android:textColor="#FFF"
android:textSize="30sp" />
复制代码
浮雕效果
复制代码
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:shadowColor="#ccc"
android:shadowDx="0.5"
android:shadowDy="0.5"
android:shadowRadius="2"
android:text="浮雕效果"
android:textColor="#FF000000"
android:textSize="30sp" />
复制代码