У мене кнопка. Коли я натискаю кнопку, я повинен зробити текст жирним, інакше нормальним. Тому я писав стилі для сміливих і нормальних.
<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" />
Як я включу тло як прозоре в свій стиль?