大家好我设置我的标签布局时遇到了问题,我尽我所能完成了这项工作。知识,但我不能让它工作。 这是场景: As you can see the tabs are stuck at the bottom just above the viewpager
我已经在协调器布局中设置了选项卡布局,但是当我尝试向上滚动选项卡条不移动时,视图寻呼机覆盖并在选项卡顶部滚动。标签卡在底部,这是我的代码也许你们可以帮助我:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res-auto" app:id="@+id/coordinatorLayout" app:layout_width="match_parent" app:layout_height="match_parent">
<android.support.design.widget.AppBarLayout app:theme="@style/ThemeOverlay_AppCompat_Dark_ActionBar" app:id="@+id/mapAppbar" app:fitsSystemWindows="true" app:layout_width="match_parent" app:layout_height="UNKNOWN_DATA_0x1f401">
<android.support.design.widget.CollapsingToolbarLayout app:id="@+id/main_collapsing" app:fitsSystemWindows="true" app:layout_width="match_parent" app:layout_height="match_parent" app:layout_scrollFlags="3" app:expandedTitleMarginStart="48dp" app:expandedTitleMarginEnd="64dp" app:contentScrim="#f15524">
<fragment android:name="com.google.android.gms.maps.SupportMapFragment" android:id="@+id/map" android:fitsSystemWindows="true" android:layout_width="match_parent" android:layout_height="UNKNOWN_DATA_0x1f401" android:layout_scrollFlags="5" android:layout_collapseMode="2" />
<android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="UNKNOWN_DATA_0x7f010047" android:popupTheme="@style/ThemeOverlay_AppCompat_Light" android:layout_collapseMode="1" />
<android.support.design.widget.TabLayout android:layout_gravity="top|bottom|center_vertical|fill_vertical|center|fill" android:id="@+id/tabLayout" android:layout_width="match_parent" android:layout_height="UNKNOWN_DATA_0x7f010047" android:layout_collapseMode="1" android:tabIndicatorColor="#233" android:tabMode="0" android:tabTextColor="#1b1b1b" android:tabSelectedTextColor="#fff" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager android:id="@+id/viewPager" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton android:layout_gravity="top|bottom|left|right|center_vertical|fill_vertical|center_horizontal|fill_horizontal|center|fill|start|end" android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" android:fabSize="1" />
答案 0 :(得分:0)
尝试将此代码添加到您的课程中:
mTabLayout.setupWithViewPager(mViewPager);