0

I have a editText View, a RecyclerView and a Bottom Navigation View. When I tip on the EditText, then the keyboard opens and theRecyclerView is filled. But the BottomNavigationview is still on top of the now open keyboard, while my Recyclerview is on top of the bottomnavigation view. Now the recyclerview and edittext are overlaying while the keyboard is open. Is there any way to constrain it that the bottomnavigationview disappears while the keyboard is open?

Here is my xml file:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout     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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Abfahrtsmonitor">


<EditText
    android:id="@+id/editText"
    android:layout_width="360dp"
    android:layout_height="47dp"
    android:ems="10"
    android:hint="Suche"
    android:inputType="textPersonName"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="7dp" />

<android.support.v7.widget.RecyclerView
    android:id="@+id/Recycleview"
    android:layout_width="370dp"
    android:layout_height="441dp"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="4dp"
    android:layout_marginStart="8dp"
    app:layout_constraintBottom_toTopOf="@+id/navigation"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

<android.support.design.widget.BottomNavigationView
    android:layout_width="368dp"
    android:layout_height="48dp"
    tools:layout_editor_absoluteX="8dp"
    tools:layout_editor_absoluteY="511dp"
    android:id="@+id/navigation"
    android:layout_marginEnd="0dp"
    android:layout_marginStart="0dp"
    android:background="?android:attr/windowBackground"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:menu="@menu/navigation"/>

This is how it looks right now: How it shouldn't look

Tobias D
  • 87
  • 1
  • 2
  • 13

3 Answers3

5

Do below in your activity tag defined in Manifest.

<activity
      android:name=".YourActivity"
      android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"/>
Vir Rajpurohit
  • 1,869
  • 1
  • 10
  • 23
2

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

   <application
        android:name=".ExampleApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan"/>
</application>

This solution had worked in my case.

Fenil Patel
  • 1,528
  • 11
  • 28
1

Remove the android:windowSoftInputMode from manifest or you can set it as stateAlwaysHidden|adjustNothing.

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
Gaurav sappal
  • 81
  • 1
  • 5