【发布时间】:2011-04-13 09:55:15
【问题描述】:
有没有办法在按下按钮时将样式应用于按钮?
如果我在 style.xml 中有样式:
<resources>
<style name="test">
<item name="android:textStyle">bold</item>
</style>
</resources>
button.xml 中的选择器:
<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"/>
谢谢!
【问题讨论】:
标签: android button coding-style pressed