2
我創建了只有2個標籤的SlidingTabs,但是佈局未正確顯示。 Image 1
是輸出,我總是和Image 2
是我輸出期望達到TabLayout標題顯示不正確
輸出
預計輸出
layout.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/pager_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" />
</FrameLayout>
<test.com.example.view.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:paddingTop="?attr/actionBarSize" />
</FrameLayout>
嘗試'tabs.setDistributeEvenly(true);' –