Reputation: 22018
I have a screen that is split up in several sections, each being a layout with android:focusable="true"
set to true.
With TalkBack enabled, if you click one of these sections / layouts, Talkback will highlight that section and read every TextView
inside of it.
Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/section1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:orientation="vertical">
<TextView
android:id="@+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 1" />
<TextView
android:id="@+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 2" />
<TextView
android:id="@+id/tv3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 3" />
</LinearLayout>
... other sections here
</LinearLayout>
This is how the screen looks like when clicking the layout:
The layout is highlighted and TalkBack reads "Text 1, Text 2, Text 3".
Everything as expected.
But when I set a long click listener to one of the texts like:
findViewById<TextView>(R.id.tv2).setOnLongClickListener {
Log.d("TAG", "clicked")
true
}
that one particular TextView
is not read anymore, but simply omitted. When I click the TextView
directly (instead of the whole section / layout), it is still read.
How can I have the long click listener and the text still read by TalkBack when clicking the section?
Upvotes: 1
Views: 329