我在NestedScrollView中使用Header实现了RecyclerView。但我得到滚动问题的位置。当活动暂停然后恢复时,位置始终是自动滚动焦点到RecyclerView。在NestedScrollView中执行RecyclerView时发出位置滚动
我的XML:
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dp">
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Header"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/grid_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header"
android:layout_gravity="center_horizontal|top" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
那么如何解决这个问题?
嗨,我一直停留在同样的问题了一个多星期了。你有没有找到解决办法呢? :) – edwinj
@edwinj http://stackoverflow.com/a/36645305/842607 –