0
当我的按钮被禁用时,我需要删除文字阴影效果和按钮启用时,我需要再次添加此效果。动态删除/添加阴影效果
selector_btn.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/btn_disabled"
android:state_enabled="false" />
<item
android:drawable="@drawable/btn_pressed"
android:state_pressed="true" />
<item
android:drawable="@drawable/btn_default" />
styles.xml
<style name="TextShadow">
<item name="android:textColor">#ffffffff</item>
<item name="android:shadowColor">#0D67B9</item>
<item name="android:shadowRadius">2.0</item>
<item name="android:shadowDy">-2.0</item>
</style>
<style name="BigButton" parent="TextShadow">
<item name="android:background">@drawable/selector_btn</item>
</style>
非常感谢)它的作品)但我实现了我自己的按钮并重写drawableStateChangedmethod()来监听状态改变事件。每当状态发生变化时,都会改变文本样式。 – user3134124