我有一个按钮。当我按下按钮时,我必须将文本设置为加粗或普通样式。所以我编写了加粗和普通文本的样式。
<style name="textbold" parent="@android:style/TextAppearance">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
</style>
<style name="textregular" parent="@android:style/TextAppearance">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">normal</item>
</style>
现在我有一个button_states.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true"
style="@style/textbold" />
<item android:state_focused="false" android:state_pressed="true"
style="@style/textregular" />
<item style="@style/textregular" />
</selector>
在这个按钮的布局中,我还需要将背景设置为透明...我该怎么做?我的布局代码如下:
<Button android:id="@+id/Btn" android:background="@drawable/button_states" />
如何在样式中将背景设置为透明?