2

i have a similar problem with: Soft Keyboard Hides Toolbar

then i try to use: android:windowSoftInputMode="adjustPan" It work, my edittext appears, but my toolbar disappear.

then i try to use: android:windowSoftInputMode="adjustResize" It makes my toolbar appear but my edittext disappear.

How can i make both of my toolbar and eddittext appear?

here some picture:

Normal:

enter image description here

using : android:windowSoftInputMode="adjustPan"

enter image description here

using : android:windowSoftInputMode="adjustResize"

enter image description here

Here is my main xml:

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include
        layout="@layout/toolbar"
        android:fitsSystemWindows="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <FrameLayout
        android:id="@+id/flContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

<android.support.design.widget.NavigationView
    android:id="@+id/nvView"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@android:color/white"
    app:menu="@menu/drawer_view"
    app:headerLayout="@layout/nav_header"/>
 </android.support.v4.widget.DrawerLayout>

Here is my fragment:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
    android:id="@+id/todo_list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_above="@+id/add_button" />

<Button
    android:id="@+id/add_button"
    android:text="Add"
    android:textSize="20dp"
    android:layout_gravity="bottom|end"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="textPersonName"
    android:hint="Enter to-do activity"
    android:textSize="20dp"
    android:ems="10"
    android:id="@+id/todo_edit"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_toLeftOf="@+id/add_button"
    android:layout_toStartOf="@+id/add_button" />


</RelativeLayout>

Please help me and please explain to me...

Community
  • 1
  • 1
user3506223
  • 211
  • 1
  • 2
  • 12

0 Answers0