Anj*_*nju 5 android talkback android-recyclerview android-accessibility android-nestedscrollview
我的布局中有一个nestedscrollview,其中包含很少的文本、按钮和recyclerviews。
当对讲打开时,我可以遍历所有元素。但我面临一个问题。当我的水平 recyclerview 滚动然后我滑动以听到对讲时,焦点将移动到工具栏的第一项。然后我需要遍历所有可见项以到达水平滚动视图滚动项。
这个问题只出现在nestedscrollview 中的recyclerviews 中。
我在布局中的嵌套滚动视图以这种方式添加:
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
//my contents
</androidx.core.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)
我在布局中的 recyclerview 以这种方式添加:
<LinearLayout
android:id="@+id/photosLL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/photosRV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/list_item_photo" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是预期的行为还是问题,如何解决?
这是我最后提供的第一个链接的引用,我认为这与您的问题相关:
“在触摸模式下,没有焦点,也没有选择。一旦用户进入触摸模式,网格列表中的任何选定项目都会变为取消选择。类似地,当用户进入触摸模式时,任何聚焦的小部件都会变得不聚焦。”
我认为你需要在 recyclerView 上设置这些属性:
android:focusableInTouchMode="true"
android:descendantFocusability="beforeDescendants"
Run Code Online (Sandbox Code Playgroud)
如果您正在寻找更多信息,请阅读:
focusable 和 focusableInTouchMode 之间的区别
和
解释descendantFocusability = afterDescendants
| 归档时间: |
|
| 查看次数: |
698 次 |
| 最近记录: |