Android accessibility in edit text with hint Android accessibility in edit text with hint android android

Android accessibility in edit text with hint


From what I understand, android:hint is meant as a placeholder for text in TextViews (and its subclasses) as long as they do not display any text, whereas android:contentDescription is meant as alternative textual description for non-textual content (images...). Therefore I'd set hint on the EditText only.


I encountered the same problem and solved it by setting the hint to null when the accessibility service is enabled. Cause when it is enabled the user probably won't need the hint.

private void setAccessibility(){   if (isExploreByTouchEnabled())   {               firstName.setHint(null);      firstName.setContentDescription("first name");   }}public boolean isExploreByTouchEnabled(){   AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(ACCESSIBILITY_SERVICE);   boolean isAccessibilityEnabled = am.isEnabled();   boolean isExploreByTouchEnabled = am.isTouchExplorationEnabled();   return isAccessibilityEnabled && isExploreByTouchEnabled;}