我遇到了TableLayout的问题,如你所见,它正在NavigationBar的后面:
这两个标签有一个viewPager,它包含片段布局(TableLayout):
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TableRow
android:layout_weight="1">
<TextView
android:layout_weight="1"
android:text="/"
android:textAlignment="center"
android:background="@color/colorAccent"
/>
<TextView
android:layout_weight="1"
android:text="8-9"
android:textAlignment="center"/>
<TextView
android:layout_weight="1"
android:text="9-10"
android:textAlignment="center"/>
<TextView
android:layout_weight="1"
android:text="10-11"
android:textAlignment="center"/>
<TextView
android:layout_weight="1"
android:text="11-12"
android:textAlignment="center"/>
</TableRow>
<TableRow
android:layout_weight="1"
android:background="@color/colorAccent"
>
<TextView android:text="Sunday"
android:gravity="center_horizontal"
/>
</TableRow>
<TableRow
android:layout_weight="1"
>
<TextView android:text="Monday"
android:gravity="center_horizontal"/>
</TableRow>
<TableRow
android:layout_weight="1"
android:background="@color/colorAccent"
>
<TextView android:text="Tuesday"
android:gravity="center_horizontal"
/>
</TableRow>
<TableRow
android:layout_weight="1">
<TextView android:text="Wednesday"
android:gravity="center_horizontal"/>
</TableRow>
<TableRow
android:layout_weight="1"
android:background="@color/colorAccent"
>
<TextView android:text="Thursday"
android:gravity="center_horizontal"
/>
</TableRow>
这是viewPager:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
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/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
答案 0 :(得分:0)
在<CoordinatorLayout/>
android:fitsSystemWindows="true"