android - NestedScrollView 内的 Androidx Recyclerview
问题描述
我有一个RecyclerView
inside aNestedScrollView
但它不可滚动。如果我只是拥有RecyclerView
它本身它工作正常,所以我想知道是否有一些我忘记设置的缺失属性。
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:overScrollMode="always"
android:id="@+id/mRecyclerView"/>
</androidx.core.widget.NestedScrollView>
我也尝试将 xml 属性设置android:nestedScrollingEnabled
为 true,但没有奏效。
解决方案
你需要设置 recyclerView.setNestedScrollingEnabled(false); 在代码中或 android:nestedScrollingEnabled="false" 在您的 xml
推荐阅读
- reactjs - 连接在递归组件中不起作用
- elasticsearch - 使用 Metricbeat 监控 Logstash
- swift - 如何在swift ui的导航视图中在大标题下方添加副标题?
- spring - 基于过滤器从 ldap 读取的具有多个读取器的弹簧批处理
- html - 当我使用 datalist 时,如何解决“它违反了以下内容安全策略指令:“default-src 'self'”?
- triggers - 子对象上的 APEX 触发器更新选项列表
- python - 返回多个图的 Python 函数不起作用
- swiftui - SwiftUI 呈现警报。“警报”初始化程序的结果未使用
- android-studio - 无法加载 com.github.smarteist.autoimageslider:1.4.0
- azure-devops-server-2019 - 在升级 azure DevOps 服务器中构建代理