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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:26:09+00:00 2026-05-23T20:26:09+00:00

I made a layout that is just simply a textview that says What do

  • 0

I made a layout that is just simply a textview that says “What do you want?”, followed by a series of buttons underneath it.

All of the buttons can be clicked/touched, but when I scroll with the trackball, none of them become highlighted. I noticed, however, then when I disable the background colors on the buttons, I can see the orange box that shows that button’s focus.

Is there any way I can visibly see the focus while still being able to have a background color on the buttons?

EDIT: Found the solution! This helped A LOT. Standard Android Button with a different color

  • 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-05-23T20:26:11+00:00Added an answer on May 23, 2026 at 8:26 pm

    Rather than applying a simple background color to buttons, try applying a ColorStateList instead.

    To do so, define a new XML file at

    /res/color/buttonstate.xml
    

    and use code such as the following:

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:color="# FOCUSED COLOR HERE"
              android:state_focused="true" />
        <item android:drawable="# DEFAULT COLOR HERE" />
    </selector>
    

    Notes:

    • You can definitely add more colors for more states, such as pressed, enabled, and certain other factors.
    • In the layout or code just reference R.color.buttonstate or @color/buttonstate (the XML’s filename).
    • Make sure the default color is last. This is because it goes down the list and finds the first item that has all of the states the same as it. If you don’t provide android:state_focused="false" for the default item and put it first, it will always display.
    • You can do a similar thing with drawables and
      nine-patch drawables to make your own custom button styles.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use a Spinner that initially (when the user has not made
I need to hold my every view in one layout, so that i can
I've made a very simple app that just displays a Google map. However, it
I have a registration form on my layout grid, made out of a stackPanel.
I made a viewPager with three layouts on every page... And i want to
EDIT: I solved #2 below by simply changing the background of the TextView's parent
I made a simple extension of CheckBoxPreference so that I could have my own
I have a Map activity in a fairly complex layout. As such, I can't
I'm just beginning Android and have gotten myself stuck. I've made a simple app/view.
I have made a custom button bar as described here . Now, I want

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.