我一直在尝试将 BottomNavigationView 添加到屏幕上。通常它按预期工作,但是当键盘在屏幕中可见时,BottomNavigationView 的高度会意外增加。
我想要的是固定高度,使其与键盘保持一致。BottomNavigationView 和 Keyboard 之间不应有任何间隙。
我添加了代码和屏幕截图来帮助您理解我的问题。
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- Other views -->
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:menu="@menu/bottom_navigation_menu" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<!-- Other views -->
</androidx.drawerlayout.widget.DrawerLayout>