AccessibilityNodeInfo.AccessibilityAction.ActionScrollForward Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Action to scroll the node content forward.
[Android.Runtime.Register("ACTION_SCROLL_FORWARD")]
public static Android.Views.Accessibility.AccessibilityNodeInfo.AccessibilityAction ActionScrollForward { get; }
[<Android.Runtime.Register("ACTION_SCROLL_FORWARD")>]
static member ActionScrollForward : Android.Views.Accessibility.AccessibilityNodeInfo.AccessibilityAction
Property Value
- Attributes
Remarks
Action to scroll the node content forward.
The UI element that implements this should send a AccessibilityEvent.TYPE_VIEW_SCROLLED event. Depending on the orientation, this element should also add the relevant directional scroll actions of ACTION_SCROLL_LEFT, ACTION_SCROLL_RIGHT, ACTION_SCROLL_UP, and ACTION_SCROLL_DOWN. If the scrolling brings the next or previous element into view as the center element, such as in a ViewPager2, use ACTION_PAGE_DOWN and the other page actions instead of the directional actions.
onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (canScrollForward) {
info.addAction(ACTION_SCROLL_FORWARD);
info.addAction(ACTION_SCROLL_DOWN);
}
}
performAccessibilityAction(int action, Bundle bundle) {
if (action == ACTION_SCROLL_FORWARD || action == ACTION_SCROLL_DOWN) {
scrollForward();
}
}
scrollForward() {
...
if (mAccessibilityManager.isEnabled()) {
event = new AccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SCROLLED);
event.setScrollDeltaX(dx);
event.setScrollDeltaY(dy);
event.setMaxScrollX(maxDx);
event.setMaxScrollY(maxDY);
sendAccessibilityEventUnchecked(event);
}
}
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.