我想为Column
设置自定义的焦点顺序。
我已经按照文档中指示的将不同的焦点请求器分配给每个项,并指定了要聚焦的next
项,但似乎Talkback正在忽略我的元素焦点顺序。
以下是一个示例:
val focusRequesters = remember { List(4) { FocusRequester() } }
Column {
Text("Line 1",
Modifier
.focusOrder(focusRequesters[0]) {
next = focusRequesters[2]
down = focusRequesters[2]
right = focusRequesters[2]
}
.focusable())
Text("Line 2",
Modifier
.focusOrder(focusRequesters[1]) {
next = focusRequesters[0]
down = focusRequesters[0]
right = focusRequesters[0]
}
.focusable())
Text("Line 3",
Modifier
.focusOrder(focusRequesters[2]) {
next = focusRequesters[3]
down = focusRequesters[3]
right = focusRequesters[3]
}
.focusable())
Text("Line 4",
Modifier
.focusOrder(focusRequesters[3]) {
next = focusRequesters[1]
down = focusRequesters[1]
right = focusRequesters[1]
}
.focusable())
}
尝试将
next
、down
、right
组合使用以及单独使用,但似乎都不能改变可访问遍历顺序。
android:accessibilityTraversalAfter
和Before
在View
中执行此操作。对于LocalFocusManager
,似乎需要键盘操作/选项来触发Nexd
事件,但它们不响应 Talkback 的“下一个”事件。 - Roudi