1

我有一个 ScrollView,里面有多个 TextView(默认情况下不可聚焦)。当我使用 TalkBack 浏览屏幕时,TalkBack 只关注整个 ScrollView 并一次读取其所有内容。

我尝试了一些方法来让 TalkBack 关注每个 TextView 而不是 ScrollView 容器,但我找不到一个好的方法。这是一个示例代码:

<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>

我尝试添加android:focusable=true到每个 TextView,这使它们可以通过 TalkBack 获得焦点,但父 ScrollView 仍然首先获得焦点。理想情况下,我希望 ScrollView 完全被 TalkBack 忽略,并且焦点直接转到它的子视图。

如何让 TalkBack 完全忽略 ScrollView 并一一关注每个子 TextView?

4

1 回答 1

1

您可以android:importantForAccessibility="no"在 ScrollView 上使用让对讲绕过 rootview 并直接遍历子视图

于 2017-07-10T22:54:16.550 回答