2017-04-24 158 views
0

我一直在学习Android几个月,但我有几个问题,我找不到解决方案。 最近,我遵循一些教程,其中解释了有关TabLayout,碎片和RecyclerView,但这不值得我。 我需要一个Android界面,其中有几个选项卡,具有不同的内容,但我需要的是启用滚动。 这是我的代码:Android TabLayout和碎片

<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/coordinator_main_content" 
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.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     app:layout_scrollFlags="scroll|enterAlways" /> 

</android.support.design.widget.AppBarLayout> 


<android.support.v4.view.ViewPager 
    android:id="@+id/pager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

+0

眼下,轻扫工作正常,但里面没有ViewPager滚动 – Jotadrive

回答

1

SOLUTION:为了解决这个问题,我们必须使用NestedScrollView