我使用内循环机里面摆放嵌套滚动视图内的多个视图的持有人,有一个在onBindViewHolder(),因为嵌套滚动,getItemViewType(的回收站视图的自然行为)的变化所有项目都被称为内onBindViewHolder ()当启动回收适配器,例如我有20个项目意味着在正常情况下只有三个项目启动时调用,但在嵌套滚动视图的情况下,所有20个视图创建第一次加载。RecyclerView内嵌嵌入的滚动视图?
XML文件
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/light_gray_vd">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="@color/primaryColor"
app:expandedTitleMarginEnd="16dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax">
<include
android:id="@+id/inc_gallery"
layout="@layout/proj_galery_new"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar1"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<include
android:id="@+id/toolbar_header_view"
layout="@layout/header_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/vde_mv_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout
android:id="@+id/rlCollapseScroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/view_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</FrameLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Recyclerview内滚动型是不是一个好主意。我假设你给了Recyclerview固定的高度。我认为问题出在哪里。 – Hein
@ Hein我只用了包装内容,但是嵌套滚动视图分配给回收商的全部空间 – appukrb
你能说出版面文件吗? – Hein