Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7994217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:04:34+00:00 2026-06-04T14:04:34+00:00

I’m trying to style the CheckBox-elements I’m using in my layout. Since I want

  • 0

I’m trying to style the CheckBox-elements I’m using in my layout.

Since I want the style consistent across different Activities, I’ve created a custom Theme that I apply in the manifest.

The styles.xml file looks like this:

<style name="LightTheme" parent="@android:style/Theme.NoTitleBar">
   .
   .
   <item name="android:checkboxStyle">@style/CustomCheckBox</item>
   .
   .
</style>
.
.
<style name="CustomCheckBox" parent="@android:style/Widget.CompoundButton.CheckBox"> 
    <item name="android:button">@drawable/btn_check_selector</item> 
    <item name="android:textColor">@color/mainTextColorLight</item>
    <item name="android:textSize">15dp</item>
</style> 
.
.

The selector, which is basically identical to the CheckBox selector found in the SDK, looks like this:

<!-- Enabled states -->        
<item android:state_checked="true" android:state_window_focused="false"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_on" />
<item android:state_checked="false" android:state_window_focused="false"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_off" />

<item android:state_checked="true" android:state_pressed="true"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_on_pressed" />
<item android:state_checked="false" android:state_pressed="true"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_off_pressed" />

<item android:state_checked="true" android:state_focused="true"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_on_focused" />
<item android:state_checked="false" android:state_focused="true"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_off_focused" />

<item android:state_checked="false"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_off" />
<item android:state_checked="true"
      android:state_enabled="true"
      android:drawable="@drawable/btn_check_on" />


<!-- Disabled states -->

<item android:state_checked="true" android:state_window_focused="false"
      android:drawable="@drawable/btn_check_on_disabled" />
<item android:state_checked="false" android:state_window_focused="false"
      android:drawable="@drawable/btn_check_off_disabled" />

<item android:state_checked="true" android:state_focused="true"
      android:drawable="@drawable/btn_check_on_disabled_focused" />
<item android:state_checked="false" android:state_focused="true"
      android:drawable="@drawable/btn_check_off_disabled_focused" />

<item android:state_checked="false" android:drawable="@drawable/btn_check_off_disabled" />
<item android:state_checked="true" android:drawable="@drawable/btn_check_on_disabled" />

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.

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.

All the other custom styled elements works as intended, while the CheckBox displays this strange behavior.

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.

Can anyone spot any obvious flaws in my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:04:36+00:00Added an answer on June 4, 2026 at 2:04 pm

    Finally solved it, and the problem seemed to be some sort of name conflict.

    Renamed my selector from ‘btn_check_selector.xml’ to ‘selector_check.xml’, and did a corresponding change in my CustomCheckBox style:

    <style name="CustomCheckBox" parent="@android:style/Widget.CompoundButton.CheckBox"> 
        <item name="android:button">@drawable/selector_check</item> 
        <item name="android:textColor">@color/mainTextColorLight</item>
        <item name="android:textSize">15dp</item>
    </style> 
    

    The selector is in the ‘drawable’ folder of my project, and the density specific resources are in their respective drawable-{l|m|h|xh}dpi folders.

    This is a bit strange, as I do not have any other files named ‘btn_check_selector’ anywhere in my project. My only guess is that Eclipse was acting up!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.