0

I'm putting some settings to the checkbox, and it works. But when I take them into a style and apply them, it doesn't. Per below, first button uses the style (NOT working), second one direct settings (works). What's wrong with my style file, per below? Tks

 <CheckBox android:id="@+id/mon" android:text ="Mon" android:layout_width="80dp" android:layout_height="80dp" android:contentDescription="Monday" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" style="@style/FilledCheckButton" /> <CheckBox android:id="@+id/tue" android:text="Tue" android:layout_width="80dp" android:layout_height="80dp" android:contentDescription="Tuesday" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/mon" android:gravity="center" android:background="@drawable/v4_btn_weekday" android:button="@drawable/v4_btn_weekday" /> 

My style file:

<?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="FilledCheckButton" parent="android:style/Widget.CompoundButton.CheckBox" android:background="@drawable/v4_btn_weekday" android:button="@drawable/v4_btn_weekday" android:gravity="center"> </style> </resources> 

enter image description here

1 Answer 1

1

Try this way

<?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="FilledCheckButton" parent="@android:style/Widget.CompoundButton.CheckBox"> <item name="android:background">@drawable/v4_btn_weekday</item> <item name="android:button">@drawable/v4_btn_weekday</item> <item name="android:gravity">center</item> </style> 

For more information go to http://aproblemlikemaria.wordpress.com/2011/09/26/theming-and-styling-in-android/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.