【问题标题】:How to add View pager and recycler view under scroll view layoutscrollview布局下如何添加Viewpager和recyclerview
【发布时间】:2019-06-19 17:20:56
【问题描述】:

我在RelativeLayout 下有RecyclerViewProgressBarProgressBar 显示在中心,直到数据加载到 RecyclerView。我想在RecyclerView 的顶部和下方实现ViewPager,以便可以轻松滚动整个视图。

这是我到目前为止所做的:

<ProgressBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/progress2"
    android:layout_centerInParent="true"/>

<android.support.v4.widget.SwipeRefreshLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/refresh">

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

    </android.support.v4.widget.SwipeRefreshLayout>

</RelativeLayout>

请告诉我如何制作所需的布局。任何帮助将不胜感激。

谢谢

【问题讨论】:

    标签: android android-recyclerview android-viewpager


    【解决方案1】:

    更改layout_width & layout_height 后尝试如下:

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/progress2"
        android:layout_centerInParent="true"/>
    
    <android.support.v4.widget.SwipeRefreshLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/refresh">
    
        <android.support.v7.widget.RecyclerView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
            android:id="@+id/recycle"/>
    
        </android.support.v4.widget.SwipeRefreshLayout>
    
    </RelativeLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多