使用带有TabLayout

时间:2015-11-04 19:52:41

标签: android android-fragments android-tablayout

以下是我的问题的屏幕截图。如您所见,在屏幕的最右下方,我的浮动按钮被导航栏覆盖。任何人都可以帮我这个吗?我已在布局上使用填充。

我尝试使用android:fitsSystemWindows =“true”,但它没有帮助。

片段的XML文件:

<RelativeLayout 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="wrap_content"
android:padding="15dp"
android:fitsSystemWindows="true">

<android.support.design.widget.FloatingActionButton
    android:id="@+id/addNewReminderButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:src="@drawable/ic_add"
    app:backgroundTint="@color/md_amber_500"
    app:elevation="4dp" />
</RelativeLayout>

这是包含工具栏,AppBar等的XML。

<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/MaterialTheme">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/MaterialTheme" />

    <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"  />
</android.support.design.widget.CoordinatorLayout>

0 个答案:

没有答案