I can declare a theme and a specific button design:
<style name="MyTheme" parent="android:style/Theme.Black">
<item name="android:buttonStyle">@style/Button.b1</item>
</style>
<style name="Button.b1" parent="android:style/Widget.Button">
<item name="android:textColor">#000000</item>
</style>
The problem is that this style applies to all buttons. I would like to declare a specific button with my own style, changing each theme independently of the other buttons (something like the "save" button). Any ideas?
I tried the following:
<style name="Button.MyButton" parent="android:style/Widget.Button">
<item name="android:background">@drawable/shape</item>
</style>
<style name ="Button.MyButton.Theme1">
<item name="android:textColor">#000000</item>
</style>
<style name ="Button.MyButton.Theme2">
<item name="android:textColor">#FFFFFF</item>
</style>
<Button
android:id="@+id/save_button"
android:layout_width="0px"
style="@style/Button.MyButton"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/save"/>
Now the button does not depend on the theme, but it should also apply the style attribute that was mentioned above. Currently, it only applies attributes declared in the MyButton scope, not in MyButton.Theme1 or MyButton.Theme2.
source
share