当按钮被按下时,是否有一种方法可以将样式应用于按钮?
如果我在 style.xml 中有一个样式:
<resources>
<style name="test">
<item name="android:textStyle">bold</item>
</style>
</resources>
中的选择器:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/test_pressed"
style="@style/test"
android:state_pressed="true"/>
<item android:drawable="@drawable/test_focused"
android:state_focused="true"/>
<item android:drawable="@drawable/test_normal"/>
</selector>
那么我该如何在我的布局中引用 button.xml 文件呢?
<Button
...
android:???="button"/>
谢谢!