jbiral
jbiral

Reputation: 1459

ScrollView is getting focused by talkback instead of its child TextViews

I have a ScrollView with multiple TextViews inside (which are not focusable by default). When I use TalkBack to navigate through the screen, TalkBack only focuses the whole ScrollView and reads all of its content at once.

I tried a couple things to make TalkBack focus each TextView instead of the ScrollView container, but I couldn't find a good way to do it. Here's a sample code:

<ScrollView
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:fillViewport="true">

   <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">

      <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="@string/string"/>

      <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="@string/a_string"/>

      <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="@string/some_string"/>

   </LinearLayout>

</ScrollView>

I tried to add android:focusable=true to each TextView, which made them focusable with TalkBack, but the parent ScrollView was still getting focused first. Ideally, I would prefer if the ScrollView was completely ignored by TalkBack, and the focus goes straight to its child Views.

How can I make TalkBack completely ignore the ScrollView and focuses each child TextView one by one instead?

Upvotes: 2

Views: 2694

Answers (1)

Arrow Cen
Arrow Cen

Reputation: 753

You can use android:importantForAccessibility="no" on ScrollView to let talkback bypass the rootview and iterate through child views directly

Upvotes: 2

Related Questions