【问题标题】:Space between BottomAppBar and KeyboardBottomAppBar 和键盘之间的空间
【发布时间】:2020-05-02 14:16:03
【问题描述】:

我在使用 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"

【问题讨论】:

  • 大家好,我在这里漏掉了一点。我必须在我的协调器布局中设置 android:fitsSystemWindows="false",之前它被设置为 true。

标签: android bottomnavigationview android-bottomappbar


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-07
    • 1970-01-01
    相关资源
    最近更新 更多