How to focus Buttons (or other widgets) with TalkBack turned ON in Android Device?

核能气质少年 提交于 2020-06-03 07:33:17

问题


I'm implementing Accessibility in my application. Here's the scenario :

I have 4 buttons arranged horizontally at the very top of the screen (Activity). On the click of a button, I'm launching an Alert Dialog which displays something to the user. With the alert being displayed, I will still be able to perform click operations on those 4 buttons at the top of the screen. When I turn ON TalkBack (Android Accessibility Service) in Android device and click on that button, alert is getting displayed but I'm unable to move the focus (a yellow rectangular box which will be there when TalkBack feature is turned ON in Android phone) to those 4 buttons. Please help!


回答1:


Try to set the below properties to your buttons

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




回答2:


You won't be able to do it with a dialog, you'll need to fake it with a View.

Perhaps you are using the wrong component which is why it sounds odd when you describe it? A picture of your design would help provide some context.


As @aardrian says, the alert dialog is modal and will (and does) block user input from the underlying UI. Clicking away from the dialog or pressing back will dismiss the dialog.

With TalkBack enabled, the user will be able to press the system back button, use the back gesture (swipe down, then left) or select an option within the dialog to dismiss it.




回答3:


Try to integrate voice control into your application via Accessibility TalkBack

Define 4 buttons, Alert Dialog Box as objects, selected by voice: button 1 button 2 ...

... I am studying the limitations of voice control of Android smartphone/ device in Blind Mode ( eyes-free)



来源:https://stackoverflow.com/questions/41020361/how-to-focus-buttons-or-other-widgets-with-talkback-turned-on-in-android-devic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!