Ferdinando D'avino
Ferdinando D'avino

Reputation: 132

BottomNavigationBar disappears when keyboard appears

in my application I have created a custom bottomNavigationView with a LinearLayout.

But I've got a problem, when the virtual keyboard appears my custom navigationView not disappears but instead it becomes smaller and moves to my keyboard.

So can I make it disappear when the keyboard appears? Or somehow can I set the layout like a fixed element ?

This is the layout I'm using

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="it.peoople.main.MainActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="20"
    android:orientation="vertical"
    >

    <FrameLayout
        android:id="@+id/head_layout"
        android:layout_width="match_parent"
        android:minHeight="52dp"
        android:layout_height="wrap_content"
        >
    </FrameLayout>

    <FrameLayout
        android:id="@+id/center_layout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"
        >
    </FrameLayout>


</LinearLayout>

<!-- menu -->
<LinearLayout
    android:layout_weight="1.5"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:orientation="horizontal"
    android:layout_marginTop="4dp"
    android:layout_marginBottom="4dp"
    >

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item1"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item2"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item3"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item4"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item5"
        />

</LinearLayout>

Thank you for your attention.

Upvotes: 1

Views: 649

Answers (1)

king_abu1918
king_abu1918

Reputation: 284

You still want the soft keyboard to show correct? This will help if want your bottom navigation bar to stay at the bottom and be covered until the soft keyboard hides again.

In your manifest, put this in the activity that you use the keyboard. Like so:

    <activity
        android:name=".YourActivityName"
        //ADD THIS LINE 
        android:windowSoftInputMode="stateHidden|adjustPan" >
    </activity>`here

Upvotes: 2

Related Questions