jonDoe
jonDoe

Reputation: 268

Android Accessibility: Switch access view elements scan order

I am designing an accessibility application in android which will be accessed using a bluetooth switch. The bluetooth switch will have two buttons:

"Next" to navigate through the view elements & "Enter" to click the view elements.

The problem that I am facing now is, I would like the focusing to the view elements to start from a certain view and then specify the focus ordering to other view elements and other elements like Keyboard rows e.t.c. I know that in layout xml, we can specify the next Focus with "nextFocusForward" but that is not helping my case.

What I want is to specify which of my view elements gets the scan focus first, and then next and so on. I may be able to set the next focus, but how do I set the very first focus? Also, how do I set the focus ordering in the ActionBar.

My ideal ordering will be(on the following example screen): EditText -> keyboard / keyboard rows / The button row(and the buttons)/ The actionable elements.)

enter image description here

Can you please help me with this? Thanks in advance!

Upvotes: 1

Views: 968

Answers (1)

Shashank Bhushan
Shashank Bhushan

Reputation: 141

Try using android:accessibilityTraversalBefore="@+id/viewId"

This will set the id of a view before which this one is visited in accessibility traversal. A screen-reader must visit the content of this view before the content of the one it precedes.

More documentation : https://developer.android.com/reference/android/view/View.html#attr_android:accessibilityTraversalBefore

Upvotes: 2

Related Questions