6

I want to add Accessibility features to my Android app. To provide the best UX for users, I need to add focusable="true" and contentDescription tags to all control elements on the screen. The problem is, I have used ConstraintLayout. For example, I have button that consists of two ImageViews:

    <ImageView
        android:id="@+id/outside"
        app:layout_constraintTop_toBottomOf="..."
        app:layout_constraintBottom_toTopOf="..."
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        style="@style/outsideElement"
        />

    <ImageView
        android:id="@+id/inside"
        app:layout_constraintBottom_toBottomOf="@+id/outside"
        app:layout_constraintEnd_toEndOf="@+id/outside"
        app:layout_constraintStart_toStartOf="@+id/outside"
        app:layout_constraintTop_toTopOf="@+id/outside"
        style="@style/insideElement"
        />

Now, when TalkBack or Accessibility Scanner applied, first it shows outside element and then inside element. I would like to have focusable both of them. The problem is in flat structure. If I would have both of them in RelativeLayout, LinearLayout, etc., I just need to add focusable="true" to the upper layout. But I want to keep flat structure and ConstraintLayout. Any idea how to solve it with flat structure? Thanks in advance.

Tom11
  • 2,419
  • 8
  • 30
  • 56
  • 2
    This question has been asked before and as far as I know, there is no solution.. other than continuing to use Viewgroups as containers around what you want to group for accessibility.: https://stackoverflow.com/questions/50041642/how-to-create-accessible-focus-groups-in-constraintlayout – JustinMorris Aug 16 '18 at 14:03

0 Answers0