0

Keyboard pushing content of edittext up when I start writing something , already add android:windowSoftInputMode="adjustResize" in AndroidManifest. Please provide solution for this issue.

Here is my code.

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.mouad.fixmyphone.fragment.SendUsFragment"
android:background="#ffff">

<!-- TODO: Update blank fragment layout -->


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="20dp">
    <View
        android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:layout_below="@id/idtitle"
        android:background="#000000" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="E-mail :"
        android:textSize="20sp"
        android:textStyle="bold"
        android:textColor="#1A237E"
        android:layout_marginTop="90sp"
        android:id="@+id/textView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <Button
        android:text="SEND"
        android:textStyle="bold"
        android:layout_width="130sp"
        android:layout_height="wrap_content"
        android:id="@+id/sendbtn"
        android:textColor="#ffffff"
        android:background="@drawable/roundshapebtn"
        android:layout_marginTop="17dp"
        android:layout_below="@+id/msgtext"
        android:layout_centerHorizontal="true" />

    <EditText
        android:background="@drawable/rounded_edittext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Your Problem in Short"
        android:textStyle="bold"
        android:id="@+id/msgtext"
        android:maxLength="80"
        android:maxLines="2"
        android:inputType="textMultiLine"
        android:layout_below="@+id/textmsgview"
        android:layout_alignParentLeft="true"
        android:drawableLeft="@drawable/ic_pb"
        android:layout_alignParentStart="true"
        android:drawablePadding="20dp"
        android:paddingLeft="1dp"
        android:paddingRight="12dp"
        android:paddingTop="12dp"
        android:paddingBottom="12dp"
        android:layout_marginTop="17dp"/>

    <EditText
        android:background="@drawable/rounded_edittext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Your E-mail . . ."
        android:textStyle="bold"
        android:id="@+id/emailtext"
        android:inputType="textEmailAddress"
        android:drawableLeft="@drawable/ic_email"
        android:drawablePadding="20dp"
        android:paddingLeft="1dp"
        android:paddingRight="12dp"
        android:paddingTop="12dp"
        android:paddingBottom="12dp"
        android:layout_below="@+id/textView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="17dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Tell us your problem :"
        android:textSize="20sp"
        android:textStyle="bold"
        android:textColor="#1A237E"
        android:layout_marginTop="20dp"
        android:id="@+id/textmsgview"
        android:layout_below="@+id/emailtext"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp" />

</RelativeLayout>

Sandip Armal Patil
  • 6,241
  • 21
  • 93
  • 160
ALiiLA
  • 55
  • 1
  • 11

2 Answers2

0

it seems like you use adjust_resize for the keyboard, the view will be "resized" to fit your view(i mean layout) if you dont want any resize, change to adjustPan

FYR Difference between adjustResize and adjustPan in android?

Community
  • 1
  • 1
CbL
  • 734
  • 5
  • 22
  • adjustPan push up all content of layout :( – ALiiLA Feb 18 '17 at 12:39
  • if you want it resize whole layout at once maybe try to use a LinearLayout to implement the layout and let it resize with their weight. if you just dont want all content pull up, try use the ScrollView to include the contents to allow it only pull up a little bit to show the editText. sorry for bad english – CbL Feb 18 '17 at 12:56
0

Problem solved with ScrollView

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout 
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   xmlns:android="http://schemas.android.com/apk/res/android">
   <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <LinearLayout 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="vertical">
              <!-- Content here -->
        </LinearLayout>
   </ScrollView>
 </LinearLayout>
ALiiLA
  • 55
  • 1
  • 11