简体   繁体   中英

Android TalkBack focuses behind a transparent layer

I have a transparent view in my app on top of a few fragments. So my fragments are below the transparent overlay, but they are not reachable by the user while the overlay is opened, as touching the overlay will dismiss it. All work fine up to the point when I enable TalkBack

My problem is that when I have TalkBack enabled and I swipe to select the next element, once TalkBack has finished with everything in the overlay, it will start setting focus on items below overlay. Is there any way to stop it from doing so? Something similar to the android:clickable="true" or using an onClick listener for making the transparent overlay intercept all clicks?

On API 19+, you can set the accessibility importance of root view of the hierarchy that you want to hide from TalkBack to be NO_HIDE_DESCENDANTS . This will prevent TalkBack from focusing anything in that hierarchy, and this is how we handle the navigation drawer scrim.

On previous versions, there's no good way to accomplish this. There are some bad ways involving manually hiding nodes from the AccessibilityNodeInfo for the root view, though, and you can check those in the DrawerLayout source code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM