ฉันมีปุ่ม เมื่อฉันกดปุ่มฉันต้องทำให้ข้อความเป็นตัวหนาอย่างอื่นปกติ ดังนั้นฉันจึงเขียนรูปแบบสำหรับตัวหนา & ปกติ
<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" />
ฉันจะใส่พื้นหลังให้โปร่งใสในสไตล์ของฉันได้อย่างไร