Search code examples
androidfocustalkback

How to get Talkback's rectangle foucse on DrawerLayer?


In my application I use DrawerLayout to show same help information. So I put it over actuall activity. Now I want to add TalckBack function and I cannot make that the any of view in DrawerLayout get the yellow rectangle (which marks focus in talkback mode). The Drawerlayout view is loaded on demand by inflantign it.

drawerLayout = (DrawerLayout) ((Activity) mContext).findViewById(R.id.drawer);
drawerHelp = (RelativeLayout) LayoutInflater.from(mContext).inflate(R.layout.help, drawerLayout, false);

What I try:

in xml add:

android:focusable="true"
android:focusableInTouchMode="true"
android:importantForAccessibility="yes" 

In code:

requestChildFocus()
requestFocus()
requestChildFocusFromTouch()

but still no luck. So how to force the rectangle mark in talkback mode for ImageButton?


Solution

  • I solve my problem by adding

    android:importantForAccessibility="no"
    

    to all element in drawer layout and to other not nedeed elements in help layout.