0

是否可以通过任何方式更改 textview 文本阴影颜色

类似于更改文本颜色

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:color="@color/white" android:state_focused="true"/> <!-- focused -->
<item android:color="@color/white" android:state_focused="true" android:state_pressed="true"/> <!-- focused and pressed -->
<item android:color="@color/white" android:state_pressed="true" /> <!-- pressed -->
<item android:color="@color/black"/> <!-- default -->

4

2 回答 2

1

在中创建样式styles.xml

<style name="myshadowstyle">   
    <item name="android:shadowColor">#ff8800</item>
    <item name="android:shadowRadius">2</item>
</style>

现在在您的选择器 xml中

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item style="@style/myshadowstyle" android:state_focused="true"/> <!-- focused -->
<item style="@style/myshadowstyle" android:state_focused="true" android:state_pressed="true"/> <!-- focused and pressed -->
<item style="@style/myshadowstyle" android:state_pressed="true" /> <!-- pressed -->
<item android:color="@color/black"/>
</selector>
于 2013-05-13T06:51:38.127 回答
0
textView.setShadowLayer(2.0f, 0.0f, 0.0f, Color.GRAY);
于 2015-01-14T20:13:53.190 回答