0

我遇到了 BottomAppBar 和 SoftInputKeyboard 的问题。

我有这样的表格: 在此处输入图像描述

现在我使用了 BottomAppBar 和 BottomNavigationView 作为菜单选项。

这是我所做的。

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/MyAppTheme.AppBarOverlay"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize">

                <TextView
                    android:id="@+id/tv_toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:layout_centerInParent="true"
                    android:gravity="center"
                    android:textSize="16sp" />
            </RelativeLayout>
        </androidx.appcompat.widget.Toolbar>
    </com.google.android.material.appbar.AppBarLayout>


    <fragment
        android:id="@+id/nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="56dp"
        android:layout_marginBottom="56dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/appbar"
        app:navGraph="@navigation/mobile_navigation" />

</androidx.constraintlayout.widget.ConstraintLayout>

<com.google.android.material.bottomappbar.BottomAppBar
    android:id="@+id/bottom_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:clickable="false"
    app:fabAlignmentMode="center"/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:backgroundTint="@color/colorAccent"
    android:src="@drawable/ic_menu_camera"
    app:layout_anchor="@id/bottom_bar" />

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="@android:color/transparent"
    app:elevation="0dp"
    app:menu="@menu/home" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>

现在,当我尝试在 editText 中填写信息时,键盘会打开。它看起来像这样:

在此处输入图像描述

键盘和bottomAppBar 之间有一个不寻常的间隙。我想在用户填写信息时保持滚动行为,因为我们在此表单中有更多字段。

我想删除它。我在这里错过了什么!!谁能帮帮我?

在清单中,我有

android:windowSoftInputMode="adjustResize"

4

1 回答 1

1

是的,设置android android:fitsSystemWindows="false"效果很好。我有同样的问题,但现在已经解决了。

于 2020-06-25T00:07:43.860 回答