Skip to main content
Logo Appt Light

Accessibility focus indicator on Android

Users should know which element has focus when using a keyboard or assistive technology. For example, you could show a rectangle around the focused element. Or you can adjust the colors whenever an element receives focus. Focus indicators can take many different forms. The focus indicator should remain visible while the element is in focused state.

On Android, you can adjust colors when an element receives focus. However, it's not possible to change the focus indicator of assistive technologies. Users can adjust their preferences in the system settings of Android.

You can use a ColorStateList to change colors based on the element state. An element moves into the state_focused whenever it receives focus.

The code sample below shows how to change the background color of a button on focus.

<!-- selector.xml -->
<selector xmlns:android="">
    <item android:drawable="@color/focused" android:state_focused="true" />
    <item android:drawable="@color/default" />

<!-- layout.xml -->


Let us know!