RecyclerView relay function is not very good

Now I use RecyclerView instead of ListView to create an Android app that helps help blind people.

The problem is when I run the talkback function. The reader reads the list one by one, where I cannot control how the reader moves to the next or previous element with my gesture. I can wait for the reader until I get to what I need. My test phone is the Samsung S4.

According to my colleague, the talkback function works well with a gesture in a regular ListView.

Now I'm just wondering, is this a bug in the RecyclerView API? or is something wrong with the settings or codes?

In any case, I will continue to test it.

+6
source share
2 answers

This is because recyclerView is focused as a ViewGroup, while the items in the list do not receive focus.

So in the layout XML file for ViewHolder, set the focusable attribute to true.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true" style="@style/ItemInView"> 

If the problem still exists, try this in your snippet:

 mRecyclerView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); 
+9
source

I realized this problem by setting

Android: clickable = true

for elements (text views) in the layout, and it worked fine in my case.

+1
source

Source: https://habr.com/ru/post/983489/


All Articles