Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does "ActionBarDrawerToggle" show its "openDrawerContentDescRes" and "closeDrawerContentDescRes" strings?

Background

The CTOR of "ActionBarDrawerToggle" is as such:

public ActionBarDrawerToggle (Activity activity, DrawerLayout drawerLayout, int openDrawerContentDescRes, int closeDrawerContentDescRes)

or:

public ActionBarDrawerToggle (Activity activity, DrawerLayout drawerLayout, Toolbar toolbar, int openDrawerContentDescRes, int closeDrawerContentDescRes)

The documentation tells you about the strings parameters, that (here ) :

String resources must be provided to describe the open/close drawer actions for accessibility services.

The problem

I can't find a scenario that those strings are being used.

What I've tried

As opposed to action items, where I can see a toast each time I long click an item, here I couldn't find in which case I can see it.

The question

Why is it required? In which cases is it shown?

Is it like what's happening to ImageView ? If so, I'd still like to know when those strings are used and how (on both ImageView and here).

like image 662
android developer Avatar asked Jan 27 '15 15:01

android developer


People also ask

How do I use actionbardrawertoggle?

To use ActionBarDrawerToggle, create one in your Activity and call through to the following methods corresponding to your Activity callbacks: Call syncState () from your Activity 's onPostCreate to synchronize the indicator with the state of the linked DrawerLayout after onRestoreInstanceState has occurred.

How does drawertoggle work with a toolbar?

When DrawerToggle is constructed with a Toolbar, it sets the click listener on the Navigation icon.

How to listen for clicks on navigation icon when drawertoggle is disabled?

If you want to listen for clicks on the Navigation icon when DrawerToggle is disabled ( setDrawerIndicatorEnabled (boolean), you should call this method with your listener and DrawerToggle will forward click events to that listener when drawer indicator is disabled.


1 Answers

Those are string resources for content descriptions. They are not displayed on screen, but accessibility services can use them to, for example, say aloud what the content is for users who are visually impaired using text-to-speech. That way you could have the device produce audio saying "drawer open" or "drawer closed" (or any other strings) when the drawer opens or closes, so blind users know what happened in the app.

like image 151
Karakuri Avatar answered Sep 28 '22 02:09

Karakuri