使用底部导航栏和无操作栏时,片段主机会下移

时间:2020-05-10 11:14:33

标签: android-fragments uinavigationbar android-bottomnav

首先,导航部分按预期工作,唯一的问题是,我的片段宿主向下移动了一点到屏幕中央。 shifted fragment host

我正在使用Theme.AppCompat.NoActionBar主题。

导航主机的配置如下:

<fragment
    android:id="@+id/nav_host_fragment"
    android:name="androidx.navigation.fragment.NavHostFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBackgroundDark"
    app:defaultNavHost="true"
    app:layout_constraintBottom_toTopOf="@id/nav_view"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0"
    app:navGraph="@navigation/mobile_navigation" />

这是底部导航栏的代码:

    <com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/nav_view"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    app:itemBackground="@color/colorBackroundBright"
    android:theme="@style/BottomNavigationTheme"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:menu="@menu/bottom_nav_menu" />

如何向上移动片段主机以填充上方的空间?

0 个答案:

没有答案
相关问题