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

  • Home
  • SEARCH
  • 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 8994629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:28:31+00:00 2026-06-15T23:28:31+00:00

I have a simple selector that has a selected state so I can setSelected(true)

  • 0

I have a simple selector that has a selected state so I can setSelected(true) on my Button and it shows it to be selected. I’m creating an ActionBar type looking thing. It works well on some android devices (nexus tablet) (v4.1.2) but on Samsung Galaxy S2 (v2.3.6) it hides the text of the button when I invoke setSeletcted(true) state. Anyone know why this could be happening?

My *button_tab_selected* and *button_tab* png image resources are both 47×47 9 patches.

drawable_tabcontrolbutton.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/button_tab_selected" android:state_selected="true"/>
    <item android:drawable="@drawable/button_tab"/>
</selector>

Layout Code

<Button
    android:id="@+id/button_draws"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:background="@drawable/drawable_tabcontrolbutton"
    android:padding="0dp"
    android:text="DRAWS"
    android:textSize="18sp" />

<Button
    android:id="@+id/button_results"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:background="@drawable/drawable_tabcontrolbutton"
    android:padding="0dp"
    android:text="RESULTS"
    android:textSize="18sp" />

Java Code

    final Button button_draws = (Button) findViewById(com.tattsbet.android.R.id.button_draws);
    button_draws.setSelected(true);
    final Button button_results = (Button) findViewById(com.tattsbet.android.R.id.button_results);

    button_draws.setOnClickListener(new OnClickListener()
    {

        @Override
        public void onClick(View v)
        {
            button_draws.setSelected(true);
            button_results.setSelected(false);
            drawsSelected();
        }
    });
    button_results.setOnClickListener(new OnClickListener()
    {

        @Override
        public void onClick(View v)
        {
            button_results.setSelected(true);
            button_draws.setSelected(false);
            resultsSelected();
        }
    });
  • 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-15T23:28:32+00:00Added an answer on June 15, 2026 at 11:28 pm

    It might be a Button style problem. You should define an exact color by using the textColor attribute in your xml. White background/white text might be the cause.
    Styles can be different phone to phone, version to version.

    It’s good to explicitly define all style properties to avoid these kind of problems.

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

Sidebar

Related Questions

The following scenario bothers me: I have a simple WPF Window that has a
i have a very simple table with only one row that has a uiswitch
I have a retain/release project that has a simple algorithm. I start out w/
I have a problem that hopefully has a simple solution. I am trying to
I have a simple jQuery selector that selects all links without a class of
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (
I have simple php validation form that is halfway working. If you leave the
I have simple win service, that executes few tasks periodically. How should I pass
How do I write jQuery selector to test if li has ul that has
If I wanted to create a simple class that has three instance variables and

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.