Answer the question
In order to leave comments, you need to log in
How to style an app in android?
How to make two button styles that depend on the selected theme?
For one button, everything is clear here:
<!-- Тема по умолчанию -->
<style name="DefaultTheme" parent="@style/_DefaultTheme"/>
<style name="_DefaultTheme" parent="android:Theme.Light">
<item name="android:buttonStyle">@style/ButtonDefaultTheme</item>
</style>
<!-- Стиль кнопок по умолчанию -->
<style name="ButtonDefaultTheme" parent="android:Widget.Button">
<item name="android:background">@drawable/defaulttheme_btn_default_holo_light</item>
<item name="android:minHeight">48dip</item>
<item name="android:minWidth">64dip</item>
<item name="android:textColor">#000000</item>
</style>
Answer the question
In order to leave comments, you need to log in
And why not define different styles and only then hang them on buttons?
For example like this:
<style name="WhiteButtonStyle" parent="@android:style/Widget.Button">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="RedButtonStyle" parent="@android:style/Widget.Button">
<item name="android:textColor">@android:color/red</item>
</style>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="StyleWhite"
style="@style/WhiteButtonStyle" />
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="StyleRed"
style="@style/RedButtonStyle" />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question