Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Android Accessibility - The missing manual

10,846 views

Published on

Android provides great accessibility support, but finding that information can sometimes be difficult to impossible. This presentation gathers some hard to find information on Android Accessibility and gives additional links to resources for making your application accessible.
Please visit the accessible version of this presentation for slide details: http://www.last-child.com/android-a11y-missing-manual/

Published in: Mobile

Android Accessibility - The missing manual

  1. 1. Android Accessibility The Missing Manual Ted Drake, Intuit Accessibility
  2. 2. Testing
  3. 3. Android Lint
  4. 4. AccessibilityChecks • AccessibilityChecks released at Google IO 2015 • Open Source tests for Espresso and Robolectric • Soon: Android app that lets you test on a device • Goal: Adopt AccessibilityChecks for Appium
  5. 5. TalkBack
  6. 6. Turn on TalkBack
  7. 7. Gestures
  8. 8. Two Fingered Gestures
  9. 9. Android Accessibility Shortcut
  10. 10. Programming
  11. 11. accessibilityLiveRegion • Based on the Live Region experience in HTML + ARIA • Content is announced when it changes or appears on screen • android:accessibilityLiveRegion =“polite”
  12. 12. AccessibilityAction • Swipes and other hard to discover actions • Actions are activated from the Local Context Menu • Provide hints for actions
  13. 13. Create AccessibilityAction /** * @param actionId The id for this action. This should either be one of * the standard actions or a specific action for your app. In that case it * is required to use a resource identifier. */ public AccessibilityAction(int id, CharSequence label)
 new AccessibilityAction(R.id.dismiss, getString(R.string.dismiss));
 new AccessibilityAction(ACTION_CLICK, getString(R.string.play_song)); ! 
 // Constants for all the standard actions with default label: AccessibilityAction.ACTION_CLICK
  14. 14. Handling a Custom Action eventView.setAccessibilityDelegate(new AccessibilityDelegate { @Override public onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); info.addAction(new AccessibilityAction(R.id.dismiss, } @Override getString(R.string.dismiss))); public boolean performAccessibilityAction(View host, int action, Bundle args) { if (action == R.id.dismiss) {} // Logic for action } });
  15. 15. android:importantForAccessibility noHideDescendants noHideDescendants noHideDescendants auto
  16. 16. ListPopupWindow setModal(true)
  17. 17. Forms
  18. 18. Form Labels Which is correct? • android:hint • android:labelFor • android:contentDescription
  19. 19. <TextView android:layout_height="match_parent" android:labelFor="@+id/edit_item_name" android:text=“Invoice amount"/> <EditText android:id="@+id/edit_item_name" android:layout_height="wrap_content" android:hint=“Invoice Amount"/>
  20. 20. android:hint
  21. 21. android:hint • This create a placeholder text string within an input • This was the preferred method and is a hack • The hint is removed when a user adds a value to the input • Still a valid method of adding a label to an input
  22. 22. contentDescription • Invisible description for TalkBack • Should not be used directly on an input • You can use it on an input’s container and combine with labelFor
  23. 23. textinputlayout <textinputlayout android:labelfor="@id/signupemail" android:contentdescription="Email" android:accessibilityliveregion="polite"> <edittext android:id="@id/signupemail" android:hint="Email" android:seterror="Create a valid email address"…/> </textinputlayout>
  24. 24. Checking for TalkBack AccessibilityManager am = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); boolean isAccessibilityEnabled = am.isEnabled(); boolean isExploreByTouchEnabled = am.isTouchExplorationEnabled();
  25. 25. Android Documentation • Creating an Accessible App • Developing an Accessible Service • Android Fragments • Android Properties and TalkBack • Robolectric + Espresso • Android Accessibility Design • Accessibility Checks

×