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 ImageView
s:
<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.