Akash Bisht
Akash Bisht

Reputation: 143

Space between BottomAppBar and Keyboard

I am having a issue with BottomAppBar and SoftInputKeyboard..

I have a form like this : enter image description here

Now i have used BottomAppBar and BottomNavigationView for the menu options on it.

Here is the what i have done.

<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>

Now When I try to fill information in the editText, and keyboard opens up. It looks like this :

enter image description here

There's an unusual gap between keyboard and bottomAppBar. I want to keep the scrolling behaviour when user fills information, as we have more fields in this form.

I want to remove it. What am I missing here!! Can anyone please help me out?

In manifest, I have

android:windowSoftInputMode="adjustResize"

Upvotes: 0

Views: 425

Answers (1)

Kotlander
Kotlander

Reputation: 21

Yes, setting android android:fitsSystemWindows="false" works very well. I had the same problem, but now it is fixed.

Upvotes: 2

Related Questions