My app has a bunch of buttons in it. The app runs on an Amazon Firestick, so it uses the remotes "D-Pad" to navigate among the buttons.
When a button gets the "focus", it changes color (hilights). But the color change from normal button background to hilight background is very small and hard to notice.
I want to make the difference between the button's normal background color and "focus" background color have more contrast so its real easy to see which button has the focus.
I am hoping this can be done via a theme in the manifest instead of having to add code in each buttons "Got_Focus" event.
But I can't figure out how to do this - I have no idea what the name of that color attribute is.
I was hoping there was a way to set the focused color through a theme so I wouldn't have to manually run code for each button, but I guess that is not possible.
I ended up creating a sub to automatically format the buttons even if I add new ones in the future:
B4X:
Sub FormatButtons(P as Panel)
Dim Focused, NotFocused As ColorDrawable
Focused.Initialize(Colors.Blue, 0dip)
NotFocused.Initialize(Colors.RGB(100,100,100),0)
For Each v As View In P
If GetType(v).ToLowerCase = "android.widget.button" Then
Dim sld As StateListDrawable
sld.Initialize
sld.AddState(sld.State_Focused, Focused)
sld.AddState(sld.State_Enabled, NotFocused)
v.Background = sld
End If
Next
End Sub