2017-04-24 159 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