Thursday, 15 March 2012

android - Tinting Checkbox on pre v21 -



android - Tinting Checkbox on pre v21 -

so, want apply tint appcompat checkbox.

everything works fine on lollipop:

android:buttontint="@color/purple_ff4081"

or way:

android:theme="@style/theme.mytheme.purpleaccent"

but setting of params not alter on pre-lollipop. works if set coloraccent app theme. don't want widgets alter look, 1 checkbox. there way without setting colored drawables?

quick fyi has changed after introduction of appcompatactivity , new back upwards libraries, for reference (outlined beautifully here) checkbox can tinted using theme atttribute , setting colorcontrolnormal , colorcontrolactivated:

styles.xml

<style name="mycheckbox" parent="theme.appcompat.light"> <item name="colorcontrolnormal">@color/indigo</item> <item name="colorcontrolactivated">@color/pink</item> </style>

layout xml:

<checkbox android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="check box" android:theme="@style/mycheckbox"/>

android checkbox

No comments:

Post a Comment