如何在滚动视图中滚动RecyclerView上方的所有内容
how to scroll all above RecyclerView in scrollview
我必须在滚动视图中实现RecyclerView,如下所示,但不能滚动RecyclerView.
I have to implement RecyclerView in scrollview show as below code, but not scroll RecyclerView.
请给出答案
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/horizontalScrollView" android:layout_marginTop="10dp"> <RelativeLayout... <android.support.v7.widget.RecyclerView android:id="@+id/rvpouch" android:layout_width="match_parent" android:layout_height="match_parent" android:nestedScrollingEnabled="false" android:layout_below="@+id/textView3"> </android.support.v7.widget.RecyclerView> </RelativeLayout> </ScrollView>推荐答案
请勿在ScrollView中使用RecyclerView.使用NestedScrollView代替ScrollView.
Don't use RecyclerView inside ScrollView. Use NestedScrollView instead of ScrollView.
NestedScrollView就像ScrollView一样,但是它支持表演 作为新老的嵌套滚动父级和子级 版本的Android.默认情况下,嵌套滚动处于启用状态.
NestedScrollView is just like ScrollView, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.
例如:
<android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:descendantFocusability="blocksDescendants"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView_one" android:layout_width="match_parent" android:layout_height="wrap_content" android:nestedScrollingEnabled="false"> </android.support.v7.widget.RecyclerView> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView_two" android:layout_width="match_parent" android:layout_height="wrap_content" android:nestedScrollingEnabled="false"> </android.support.v7.widget.RecyclerView> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView_three" android:layout_width="match_parent" android:layout_height="wrap_content" android:nestedScrollingEnabled="false"> </android.support.v7.widget.RecyclerView> </LinearLayout> </android.support.v4.widget.NestedScrollView>使用属性android:nestedScrollingEnabled="false"进行平滑滚动.
Use attribute android:nestedScrollingEnabled="false" for smooth scrolling.
更多推荐
如何在滚动视图中滚动RecyclerView
发布评论