Note that there are some explanatory texts on larger screens.

plurals
  1. POCheckBox button selector results in invisble checkbox
    primarykey
    data
    text
    <p>I'm trying to style the CheckBox-elements I'm using in my layout. </p> <p>Since I want the style consistent across different Activities, I've created a custom Theme that I apply in the manifest.</p> <p>The styles.xml file looks like this:</p> <pre><code>&lt;style name="LightTheme" parent="@android:style/Theme.NoTitleBar"&gt; . . &lt;item name="android:checkboxStyle"&gt;@style/CustomCheckBox&lt;/item&gt; . . &lt;/style&gt; . . &lt;style name="CustomCheckBox" parent="@android:style/Widget.CompoundButton.CheckBox"&gt; &lt;item name="android:button"&gt;@drawable/btn_check_selector&lt;/item&gt; &lt;item name="android:textColor"&gt;@color/mainTextColorLight&lt;/item&gt; &lt;item name="android:textSize"&gt;15dp&lt;/item&gt; &lt;/style&gt; . . </code></pre> <p>The selector, which is basically identical to the CheckBox selector found in the SDK, looks like this:</p> <p> </p> <pre><code>&lt;!-- Enabled states --&gt; &lt;item android:state_checked="true" android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/btn_check_on" /&gt; &lt;item android:state_checked="false" android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/btn_check_off" /&gt; &lt;item android:state_checked="true" android:state_pressed="true" android:state_enabled="true" android:drawable="@drawable/btn_check_on_pressed" /&gt; &lt;item android:state_checked="false" android:state_pressed="true" android:state_enabled="true" android:drawable="@drawable/btn_check_off_pressed" /&gt; &lt;item android:state_checked="true" android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/btn_check_on_focused" /&gt; &lt;item android:state_checked="false" android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/btn_check_off_focused" /&gt; &lt;item android:state_checked="false" android:state_enabled="true" android:drawable="@drawable/btn_check_off" /&gt; &lt;item android:state_checked="true" android:state_enabled="true" android:drawable="@drawable/btn_check_on" /&gt; &lt;!-- Disabled states --&gt; &lt;item android:state_checked="true" android:state_window_focused="false" android:drawable="@drawable/btn_check_on_disabled" /&gt; &lt;item android:state_checked="false" android:state_window_focused="false" android:drawable="@drawable/btn_check_off_disabled" /&gt; &lt;item android:state_checked="true" android:state_focused="true" android:drawable="@drawable/btn_check_on_disabled_focused" /&gt; &lt;item android:state_checked="false" android:state_focused="true" android:drawable="@drawable/btn_check_off_disabled_focused" /&gt; &lt;item android:state_checked="false" android:drawable="@drawable/btn_check_off_disabled" /&gt; &lt;item android:state_checked="true" android:drawable="@drawable/btn_check_on_disabled" /&gt; </code></pre> <p></p> <p>The selector is stored in the 'drawable' folder of my project, and the density specific resources are stored in the drawable-{l|m|h|xh}dpi folders. </p> <p>The weird thing is that this worked very well for a long time. But today, its suddenly not working anymore. The CheckBox-elements are now showing up without the box-part. Only the text is visible.</p> <p>All the other custom styled elements works as intended, while the CheckBox displays this strange behavior.</p> <p>I've tried to apply the style directly to a CheckBox with xml, with no luck. Also done the usual 'Clean Project'. The only way I can get this to work, is to copy the selector to all the drawable-{l|m|h|xh}dpi folders in my project. I was under the impression that it was not necessary to have a copy of the selector in every drawable folder, and it certainly is not necessary for my other custom selectors.</p> <p>Can anyone spot any obvious flaws in my code? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload