如何滚动查看寻呼机&x2B;Android中的回收器视图
我有一个由两部分组成的xml布局; 在布局的顶部有一个ViewPager,下面有一个RecyclerView。(左图) 我想当回收视图向上滚动查看页移动和淡出 我的XML布局代码是:如何滚动查看寻呼机&x2B;Android中的回收器视图,android,layout,android-viewpager,android-recyclerview,nestedscrollview,Android,Layout,Android Viewpager,Android Recyclerview,Nestedscrollview,我有一个由两部分组成的xml布局; 在布局的顶部有一个ViewPager,下面有一个RecyclerView。(左图) 我想当回收视图向上滚动查看页移动和淡出 我的XML布局代码是: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="200dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/lstLatestNews"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/slider" /></LinearLayout>
您只需在滚动视图中显示布局即可
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="10dp"
android:scrollbars="none">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="200dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/lstLatestNews"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/slider" />
</LinearLayout>
</ScrollView>
您可以使用CoordinatorLayout+AppBarLayout+CollingToolBarLayout
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_group_purchase"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--广告栏-->
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll">
<com.youth.banner.Banner
android:id="@+id/banner_home_group_purchase"
android:layout_width="match_parent"
android:layout_height="@dimen/banner_height" />
</android.support.design.widget.CollapsingToolbarLayout>
<!--类别Tab-->
<include layout="@layout/layout_tab_more" />
</android.support.design.widget.AppBarLayout>
<!--分类视图-->
<android.support.v4.view.ViewPager
android:id="@+id/vp_home_group_purchase"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
感谢您的回复,我完成了,但“回收者”视图消失了!使用viewpager替换横幅和使用recyclerview替换viewpager