Android - Custom View

About

Custom view

Layout file

Android - Layout File (XML)

<com.myapp.myView
     android:height="..."
     android:width="..."
/>

Accessibility

To get access to the AccessibilityManager instance, use this code:

// Send an event to the accessibility Manager
AccessibilityManager accessibilityManager =  (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isEnabled()) {
    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
}

// Handle the event in the custom view ?
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent ev) {
  ev.getText.add("What you want?");
}

Documentation / Reference


Powered by ComboStrap