setTouchExplorationPassthroughRegion()方法用于指定在触摸探索模式下可以透过该视图传递触摸事件的区域。
使用该方法需要首先获取当前视图的AccessibilityNodeInfo对象,然后调用其setTouchExplorationPassthroughRegion(Rect)方法。
例如,下面的代码演示了如何使用setTouchExplorationPassthroughRegion()方法指定一个矩形区域,该区域在触摸探索模式下可以透过该视图传递触摸事件:
View view = findViewById(R.id.my_view);
AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.wrap(view);
Rect rect = new Rect(0, 0, 200, 200);
info.setTouchExplorationPassthroughRegion(rect);
上一篇:Android无需行数的阅读光标