LayoutInflater在Android中有什么用?
我有两个RecyclerViews垂直放置在一个LinearLayout.我需要让它们都可以滚动,这就是我放入LinearLayout内部的原因NestedScrollView
这是我的布局文件.
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/featured_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/all_topic_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
另外,我在Java代码中禁用嵌套滚动.
disableNestedScrolling(findViewById(R.id.all_topic_list));
disableNestedScrolling(findViewById(R.id.featured_list));
Run Code Online (Sandbox Code Playgroud)
我的RecylerView库版本是26.1.0
这完全正常,但随后onBindViewHolder调用列表中的所有项目的方法.理想情况下,只应为列表中的可见项调用它.
我认为这个问题正在发生的事情,因为我给wrap_content的RecyclerView.关于这个问题的很多答案都表明这个问题在v23.2.1中得到了解决,但我已经在使用v26.1.0了.如何解决这个问题?
我有一个 recyclerview,在其中我试图添加一个包含列表的嵌套 recyclerview。这是我想要做的:

这是我在堆栈溢出时能找到的最接近的解决方案,但它们使用标题而不是左对齐的标题,这些标题包含所有其他嵌套视图。如何在 recyclerview 中的嵌套 recyclerview 中创建嵌套列表?
java android android-layout android-listview android-recyclerview