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
Rather than applying a simple background color to buttons, try applying a
ColorStateListinstead.To do so, define a new XML file at
and use code such as the following:
Notes:
R.color.buttonstateor@color/buttonstate(the XML’s filename).android:state_focused="false"for the default item and put it first, it will always display.nine-patch drawables to make your own custom button styles.