android - 滚动外部 recyclerview 以显示内部 recyclerview + 部分标题
问题描述
<?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="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?android:selectableItemBackground"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:focusable="false"
android:focusableInTouchMode="false"
android:textColor="@color/white"
android:id="@+id/section_title"
android:textSize="@dimen/_10ssp"
android:layout_width="wrap_content"
android:padding="8dp"
android:layout_height="wrap_content"/>
<com.PersistentFocusWrapper
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.TvRecyclerView
android:layout_below="@id/section_title"
android:id="@+id/CarouselsRowRv"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="horizontal"
android:layout_width="match_parent"
app:tv_selectedItemOffsetEnd="658dp"
android:layout_height="125.4dp" />
</com.PersistentFocusWrapper>
</LinearLayout>
我有一个内部 recyclerView 的以下布局,它是包含多个水平 recyclerViews 的外部垂直 recyclerView 的一部分。正如您在上面的布局中看到的,每个内部 recyclerView 都有一个节标题,但是当向上滚动垂直 recyclerView 时,它最终只聚焦水平 recyclerview 项目,TextView 只是隐藏,需要再次点击 dpad 才能显示。如何让垂直 recyclerView 在向上滚动时显示标题。
我尝试添加 android:descendantFocusability="blocksDescendants" 但这完全消除了我不想要的水平 RecyclerView 项目的焦点。
解决方案
解决方案不是将 Outer recyclerView 放在 ScrollView 中,而是使用 FrameLayout。
推荐阅读
- ibm-cloud - IBM Cloud Monitoring - 在 Grafana 中查看自定义指标
- if-statement - Tableau - 具有 True 和 False 值的多列
- javascript - 在 For 循环中使用 $post 返回空白(未定义)
- sp - 添加比例尺以绘制 ppp 对象
- jenkins - Jenkins:Maven 发布插件在尝试使用 SVN 进行空运行时给出“未定义符号:apr_crypto_block_cleanup”
- java - 实例化没有实现类的接口
- javascript - Javascript 将数组项与其他数组中的每个项组合为文本
- spring - 找不到可接受的文件下载表示
- mongodb - MongoDb:$geoIntersects 用于多个输入坐标
- matlab - Octave 中的 linIt 函数