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 9254555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:30:00+00:00 2026-06-18T11:30:00+00:00

I followed this example for applying some custom themes to my toggle buttons, but

  • 0

I followed this example for applying some custom themes to my toggle buttons, but when I run my app I see the generic android toggle icons – I think I’m missing a setting here or there and could use an extra set of eyes on it.

I have a layout for use in a ListView for which I’m trying to use custom drawables for the checked/unchecked state, with each toggle status set to CHECKED by default:

<ToggleButton
        android:id="@+id/profile_item_value_text"
        style="@style/ProfileTagTheme"
        android:layout_width="0px"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:textSize="16dp"
        android:textColor="@color/black"
        android:layout_gravity="center"
        android:gravity="center_vertical|center_horizontal"
        android:checked="true" />

Here’s what I have in my styles file for ProfileTagTheme:

<style name="Widget.Button.Toggle" parent="android:Widget">
    <item name="android:background">@drawable/profile_btn_toggle_bg</item>
    <item name="android:disabledAlpha">@android:attr/disabledAlpha</item>
</style>
<style name="ProfileTagTheme" parent="android:Theme.Black">
    <item name="android:buttonStyleToggle">@style/Widget.Button.Toggle</item>
</style>

And in turn, profile_btn_toggle_bg.xml, living in my main drawable dir:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background" android:drawable="@android:color/transparent"/>
    <item android:id="@android:id/toggle" android:drawable="@drawable/profile_btn_toggle"/>
</layer-list>

which references profile_btn_toggle, right next to it:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@drawable/tag_active" /> <!-- pressed -->
    <item android:drawable="@drawable/tag" /> <!-- default/unchecked -->
</selector>

I’ve verified the custom images are present in the drawables dir, so obviously either I’m misunderstanding something about the way the styles cascade, or I’m missing a reference somewhere in this style madness.

  • 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-18T11:30:01+00:00Added an answer on June 18, 2026 at 11:30 am

    So it seems the only real problem I had was missing the android:background element in my ToggleButton implementation; so the only change to the code above was adding that element, e.g.

    <ToggleButton
            android:id="@+id/profile_item_value_text"
            style="@style/ProfileTagTheme"
            android:background="@drawable/profile_btn_toggle_bg"
            android:layout_width="0px"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:textSize="16dp"
            android:textColor="@color/black"
            android:layout_gravity="center"
            android:gravity="center_vertical|center_horizontal"
            android:checked="true"
            android:onClick="onToggleClicked" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've followed this example: RCP+JavaWS but the app just briefly comes up and goes
I followed this example and it works great but I'm wondering if I can
I followed this example to build a multilingual app: How to: Build a Localized
I followed this example: Coffeescript and node.js confusion. require instantiates class? , but it
I have followed this tutorial to use SQLite db in my android app. Since
Followed this question about delayed_job and monit Its working on my development machine. But
I followed this tutorial . But whenever I try to log in with my
I followed this link to gzip my php driven website It's working fine but
I followed this post http://neurochannels.blogspot.com/2010/05/how-to-run-r-code-in-matlab.html , to install R(D)Com server in order to call
I followed this tutorial to get started using Android host api with an Arduino

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.