我有一个recycleview,里面有10个以上的项目。因为它有超过10个项目,它一次只显示4个项目。问题来自TalkBack,我想在列表中使用左/右拖动动作进行迭代但是在4.项目焦点转到布局上的另一个视图组件之后。如何使用Talkback迭代所有的recycleview项目?
编辑: 我使用自己的可访问性委托:
mRecyclerView.setAccessibilityDelegate(mAccessibilityDelegate);
public class AccessibilityDelegate extends View.AccessibilityDelegate {
private Assistant mAssistant;
public AccessibilityDelegate(Assistant assistant)
{
mAssistant = assistant;
}
@Override
public void sendAccessibilityEvent(View host, int eventType) {
if(!mAssistant.isSpeaking() && mAssistant.isRecognizerAvailable())
{
super.sendAccessibilityEvent(host, eventType);
}
}
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if(!mAssistant.isSpeaking() && mAssistant.isRecognizerAvailable())
{
return super.performAccessibilityAction(host, action, args);
}
return false;
}
@Override
public void sendAccessibilityEventUnchecked(View host, AccessibilityEvent event) {
super.sendAccessibilityEventUnchecked(host, event);
}
@Override
public boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
return super.dispatchPopulateAccessibilityEvent(host, event);
}
@Override
public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
super.onPopulateAccessibilityEvent(host, event);
}
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
}
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
}
@Override
public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event) {
return super.onRequestSendAccessibilityEvent(host, child, event);
}
@Override
public AccessibilityNodeProvider getAccessibilityNodeProvider(View host) {
return super.getAccessibilityNodeProvider(host);
}
}
答案 0 :(得分:1)
经过几次试验后,我发现了问题。
要覆盖RecycleView的辅助功能,请扩展RecyclerViewAccessibilityDelegate。
java -version
此外,如果你想禁用像“显示第1项第1项”这样的宣告,只需注释掉super.sendAccessibilityEventUnchecked(主持人,事件)
File > Project Structure > JDK Location
}