I'm trying to improve the a11y in our app and we have the following piece of XML:
<myapp.custom.CurrencyTextView
android:id="@+id/tvBalance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/s16"
android:layout_marginTop="@dimen/s16"
android:paddingBottom="@dimen/s2"
app:intPartTextSize="@dimen/num01FontSize"
app:layout_constraintBottom_toBottomOf="@id/tvAvailableToSpend"
app:layout_constraintStart_toStartOf="parent"
app:symbolTextSize="@dimen/caption01FontSize"
app:textColor="@color/accountAmount01" />
<myapp.custom.NoPaddingTextView
android:id="@+id/tvCurrentBalanceTitle"
style="@style/caption01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/s4"
android:accessibilityTraversalBefore="@id/tvBalance"
android:labelFor="@id/tvBalance"
android:text="@string/home_balance_spent"
android:textColor="@color/accountAmount02"
app:layout_constraintStart_toStartOf="@+id/tvBalance"
app:layout_constraintTop_toBottomOf="@+id/tvBalance" />
what I'm trying to do is to have TalkBack first read the second view tvCurrentBalanceTitle
and then the first tvBalance
but it's impossible in XML (easy to do in Compose though with the Modifier.semantics
and traversalGroup
).
I have tried with and without labelFor
and using accessibilityTraversalBefore
and after, but I can't make it work.
Am I doing something wrong with the XML?