I have this custom layout:
- LinearLayout
- FrameLayout
- ImageView
- TextView
This layout reacts to click events (using LinearLayout.setOnClickListener()
) and is made focusable using android:focusable="true"
in the layout XML file. This all works fine if you're using the touchscreen, but I'm thinking about users who don't use the touchscreen that much and prefer navigation keys or maybe even don't have a touchscreen. These users won't be able to see when that ViewGroup
is focused (although it can be focused using the keyboard).
My question is: how can I make a change in that layout when it is focused (I need to change the android:background
of the ImageView
)? I suppose I could use LinearLayout.setOnFocusChangeListener()
, but I'm thinking maybe there's a better way, using just XML files.