मेरे पास एक बटन है। जब मैं बटन दबाता हूं तो मुझे टेक्स्ट को बोल्ड करना पड़ता है अन्यथा सामान्य। इसलिए मैंने बोल्ड और सामान्य के लिए शैलियों को लिखा।
<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>
अब मेरे पास एक बटन_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" />
मैं अपनी शैली में पारदर्शी के रूप में पृष्ठभूमि को कैसे शामिल करूंगा?