I am working on an app that have several recyclerView. When I use talkback to swipe between items, it does not specify item position out of items size such as 1 out of 12.
But I created a sample app and it said item position out of items size. So I wonder what may cause that talkback does not specify the position and size in RecyclerView.
Here is my sample that worked :
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_margin="16dp"
android:gravity="center"
android:text="Hello"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
And here is list item adapter :
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="wrap_content"
android:focusable="true"
android:layout_margin="16dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/id_tag"
android:textColor="@color/colorAccent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp" />
<TextView
android:id="@+id/name"
android:textColor="@color/colorAccent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</layout>
Do you have any idea that why talkback may not say position and items size?
In Version 1.2.0-alpha02 (April 1, 2020) and newer of RecyclerView, If you would like Accessibility Services (Talkback for example) to continue indicating count and item index to the user, you will need to populate CollectionInfo and CollectionItemInfo yourself.