android AppCompat v22.1.0 button styling -
problem: cant set style buttons correctly
source devilishly simple:
styles.xml:
<style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="colorprimary">#ff00ff</item> <item name="colorsecondary">#00ffff</item> <item name="colorcontrolnormal">#ff0000</item> <item name="android:textcolor">#0030ff</item> <item name="android:textcolorprimary">#00ff00</item> <item name="android:textcolorsecondary">#800080</item> </style>
layout (applied appcompatactivity):
<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview"/> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" /> <checkbox android:layout_width="wrap_content" android:layout_height="wrap_content" />
manifest:
<application android:theme="@style/apptheme" >
problem 1 is: colorcontrolnormal doesn't affect button (but affects checkbox). how can apply color buttons?
problem 2 is: android:textcolorprimary attribute sets color button text, attribute android:textcolor overlaps it, setting color both textview , button texts. how can set them separately?
you can set default button color adding line theme.
<item name="colorbuttonnormal">@color/your_color</item>
it works on both pre-lollipop , lollipop.