ViewPager - RecyclerView - AppBar滚动问题

时间:2017-12-05 13:43:04

标签: android scroll android-recyclerview android-viewpager fragment

我正在使用Xamarin一个应用程序进行开发,但我遇到了ViewPager在标签之间滑动的问题。 ViewPager包含一些Fragments,而片段内部仅包含RecyclerCiew

问题在于,当我到达RecyclerView的顶部或底部时,如果我尝试在页面之间向左或向右滑动而不是ViewPager来采取措施,RecyclerView向上或向下滑动。

只有当空间有一点空隙时,我才可以在标签之间滑动,但不是在我真正的顶部或底部时。

  <?xml version="1.0" encoding="utf-8"?>
    <android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawerLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fitsSystemWindows="true">
    <android.support.design.widget.CoordinatorLayout 
     xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/coordinatorLayoutMain"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
      <android.support.v7.widget.Toolbar
          android:id="@+id/toolbar1Main"
          app:contentInsetStartWithNavigation="0dp" 
          app:layout_scrollFlags="scroll|enterAlways"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="?attr/colorPrimary"
          app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
      <android.support.design.widget.TabLayout
          android:id="@+id/tabLayout1Main"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          app:tabMode="scrollable" />
    </android.support.design.widget.AppBarLayout>
    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager1Main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
     </android.support.design.widget.CoordinatorLayout>
    </android.support.v4.widget.DrawerLayout>

0 个答案:

没有答案
相关问题