简体   繁体   English

如何在滚动视图布局下添加View寻呼机和回收站视图

[英]How to add View pager and recycler view under scroll view layout

I have RecyclerView and ProgressBar under RelativeLayout . 我在RelativeLayout下有RecyclerViewProgressBar ProgressBar shows in center until data loads in RecyclerView . ProgressBar显示在中心,直到RecyclerView数据加载为止。 I want to implement ViewPager on top and below it RecyclerView so that whole view can be scroll easily. 我想在RecyclerView顶部和底部实现ViewPager ,以便可以轻松滚动整个视图。

This is what I have done so far: 这是我到目前为止所做的:

<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>

Someone please let me know how can I make desired layout. 有人请让我知道如何制作所需的布局。 Any help would be appreciated. 任何帮助,将不胜感激。

THANKS 谢谢

Try after changing layout_width & layout_height like following: 更改layout_widthlayout_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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM