底部页面垂直滚动不起作用

时间:2017-05-30 12:21:34

标签: android scroll

我在底部有两个回收视图,一个是水平的,另一个是垂直的。 我可以水平滚动但不能在第二个回收站视图中垂直滚动。 有垂直滚动的方法吗?

1 个答案:

答案 0 :(得分:1)

这是我在xml中使用NestedScrollview的工作 像那样

<android.support.v4.widget.NestedScrollView 
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
   <RelativeLayout 
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical" android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:paddingTop="@dimen/activity_vertical_margin"
         android:paddingLeft="@dimen/activity_horizontal_margin"
         android:paddingRight="@dimen/activity_horizontal_margin"
         android:paddingBottom="@dimen/activity_vertical_margin"
       >

       <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerViewHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
       />
<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"


    android:id="@+id/recyclerViewFeaturedLoc"
    android:layout_below="@+id/recyclerViewHorizontal"
    android:paddingTop="@dimen/activity_vertical_margin"
    />


<ProgressBar
    android:layout_centerInParent="true"
    android:id="@+id/home_progress"

    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

然后在java文件中设置垂直滚动视图 像那样

 recyclerViewFeaturedLoc.setNestedScrollingEnabled(false);
相关问题