Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BottomNavigationView goes up when keyboard appears

Image

My BottomNavigationView works fine but it goes up when I press on the EditText to write on it. There is an image on the link above.

This is my manifest in which I included android:windowSoftInputMode="adjustPan" but it doesn't work for me. Any other suggestions?

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity"
        android:windowSoftInputMode="adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

My xml file:

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:design="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.segunfamisa.sample.bottomnav.MainActivity">

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:id="@+id/mainToolbar"
        android:background="#ffffff"
        android:titleTextColor="#ffffff">
    </android.support.v7.widget.Toolbar>

    <View
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@drawable/shadow_top"/>

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#ffffff">

    </FrameLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@drawable/shadow"/>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        design:menu="@menu/bottom_nav_items"
        design:itemIconTint="@drawable/selector"
        design:itemTextColor="@drawable/selector"
        android:background="#000000" />
</LinearLayout>
like image 475
Matias Nagore Avatar asked Mar 08 '17 15:03

Matias Nagore


2 Answers

you just add this code in your manifest like this way..

 <activity android:name=".MainActivity"
        android:windowSoftInputMode="adjustPan">

this works for me.. happy coding

like image 42
Maksudul Hasan Raju Avatar answered Oct 20 '22 19:10

Maksudul Hasan Raju


In your AndroidManifest.xml add the following android:windowSoftInputMode="adjustPan" to your activity that holds the BottomNavigationView

like image 145
Mood Avatar answered Oct 20 '22 21:10

Mood