IT. Expert System.

Android Reference

View.AccessibilityDelegate


android.view

Class View.AccessibilityDelegate

  • Enclosing class:
    View


    public static class View.AccessibilityDelegate
    extends Object

    This class represents a delegate that can be registered in a View to enhance accessibility support via composition rather via inheritance. It is specifically targeted to widget developers that extend basic View classes i.e. classes in package android.view, that would like their applications to be backwards compatible.

    Developer Guides

    For more information about making applications accessible, read the Accessibility developer guide.

    A scenario in which a developer would like to use an accessibility delegate is overriding a method introduced in a later API version then the minimal API version supported by the application. For example, the method View.onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo) is not available in API version 4 when the accessibility APIs were first introduced. If a developer would like his application to run on API version 4 devices (assuming all other APIs used by the application are version 4 or lower) and take advantage of this method, instead of overriding the method which would break the application's backwards compatibility, he can override the corresponding method in this delegate and register the delegate in the target View if the API version of the system is high enough i.e. the API version is same or higher to the API version that introduced View.onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo).

    Here is an example implementation:

    if (Build.VERSION.SDK_INT >= 14) { // If the API version is equal of higher than the version in // which onInitializeAccessibilityNodeInfo was introduced we // register a delegate with a customized implementation. View view = findViewById(R.id.view_id); view.setAccessibilityDelegate(new AccessibilityDelegate() { public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { // Let the default implementation populate the info. super.onInitializeAccessibilityNodeInfo(host, info); // Set some other information. info.setEnabled(host.isEnabled()); } }); }

    This delegate contains methods that correspond to the accessibility methods in View. If a delegate has been specified the implementation in View hands off handling to the corresponding method in this delegate. The default implementation the delegate methods behaves exactly as the corresponding method in View for the case of no accessibility delegate been set. Hence, to customize the behavior of a View method, clients can override only the corresponding delegate method without altering the behavior of the rest accessibility related methods of the host view.



Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 562 / . Delta: 0.02781 с