TextView控件有一個方法是控制陰影的加入的:
mTextView.setShadowLayer(10F, 11F,5F, Color.YELLOW); 第一個參數為模糊半徑,越大越模糊。 第二個參數是陰影離開文字的x橫向距離。 第三個參數是陰影離開文字的Y橫向距離。 第四個參數是陰影顏色。
第二種方式是將TextView控件的style單獨寫成一個.xml文件進行添加。
res/values/styles.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <resources>
- <style name="AudioFileInfoOverlayText">
- <item name="android:paddingLeft">4px</item>
- <item name="android:paddingBottom">4px</item>
- <item name="android:textColor">#f1f1f1</item>
- <item name="android:textSize">60sp</item>
- <item name="android:shadowColor">#4d4d4d</item>
- <item name="android:shadowDx">0</item>
- <item name="android:shadowDy">-3</item>
- <item name="android:shadowRadius">3</item>
- </style>
- </resources>
res/layout/main.xml
- <TextView
- android:id="@+id/tvTest"
- style="@style/AudioFileInfoOverlayText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
以上兩方式都可以實現
轉http://blog.csdn.net/svrsimon/article/details/7285909
