Android NestedScrollView包裹RecyclerView高度撑满所有item,kotlin
当用NestedScrollView包裹RecyclerView后,
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" />
</androidx.core.widget.NestedScrollView>
文章来源地址https://www.toymoban.com/news/detail-559982.html
然而设置:
recyclerView?.isNestedScrollingEnabled = false
会使得RecyclerView加载完成所有itemCount的数理,撑满整个RecyclerView高度,这深深改变了RecyclerView只加载显示当前屏幕可见区域的特性,此时RecyclerView一次性加载全部item。
文章来源:https://www.toymoban.com/news/detail-559982.html
到了这里,关于Android NestedScrollView包裹RecyclerView高度撑满所有item,kotlin的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!