Skip to content

Accessibility support

Beka Westberg edited this page Feb 5, 2020 · 4 revisions

This page describes what kind of support the LoopingLayoutManager has for accessibility, and how you can improve the accessibility of your app.

TalkBack support

TalkBack is Android's screen reader for blind and visually impared users. It also has custom navigation gestures that make navigating apps easier for those users.

Read about Testing your app's Talkback accessibility.

Default support

The LoopingLayoutManager supports all relevant TalkBack actions. Including selecting views and scrolling the layout.

TalkBack Example Video Download

If you do not have the available time to devote to accessibility, you can rest assured that the LoopingLayoutManager will be usable for blind and visually impared users.

Better support

As you can see from the video above TalkBack reads out the range of views that are currently visible. This can cause some problems for the LoopingLayoutManager specifically:

TalkBack Odd Behavior Video Download

In the above case, items 5, 6, 7, 1, and 2 are being shown, which TalkBack communicates as "showing items 5 to 2 of 7". This is confusing if you're only hearing it read, and are unable to see the state of the screen.

One way to combat this is to simply replace the LoopingLayoutManager with a LinearLayoutManager if you detect that the user is in TalkBack mode. This can be done by adding the following code to your onCreate function:

class MyActivity : AppCompatActivity() {
    private lateinit var mLayoutManager: RecyclerView.LayoutManager

    override fun onCreate(savedInstanceState: Bundle?) {
        val service = applicationContext.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
        val touchEnabled = service.isEnabled && service.isTouchExplorationEnabled
        mLayoutManager = if (touchEnabled) {
            LinearLayoutManager(this, RecyclerView.HORIZONTAL, false)
        } else {
            LoopingLayoutManager(this, RecyclerView.HORIZONTAL, false)
        }

        // etc...
   }
}

The example is written in Kotlin.

Voice Access

Voice Access allows motor impared users to navigate applications using voice commands. This is functionality is automatically supported, and is compatible with the LoopingLayoutManager. Developers implementing the LoopingLayoutManager in their application do not need to do any extra work to support Voice Access.