Rodjaaa
Rodjaaa

Reputation: 35

Android layout hidden on keyboard show

I have a strange problem with my layout. When i tap on EditText, keyboard is shown but my EditText stay on bottom, when I tap on back to hide keyboard, keyboard hides and EditText go up where it should be when i want to input text. When I tap again, keyboard is shown and EditText goes down behind the keyboard...

<RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      >
     <ScrollView
          android:layout_width="match_parent"
          android:layout_height="fill_parent"
          android:above="@+id/rl_commands">
          <TextView
               android:layout_width="match_parent"
               android:layout_height="wrap_content"/>
    </ScrollView>
    <RelativeLayout
          android:layout_width="match_parent
          android:layout_height="24dp"
          android:id="@+id/rl_commands"
          android:alignParentBottom="true">
          <EditText
            ............/>
          <Button
           .........../>
 </RelativeLayout>
</RelativeLayout>

Also in manifest.xml I added adjustResize but problem stays.... What i want is that when I tap(focus) EditText and keyboard shows, RelativeLayout go up to see what I am typing. And after keyboard hide to resize RelativeLayout again and RelativeLayout go to bottom of screen. Like in viber...

Upvotes: 1

Views: 2536

Answers (2)

ashishmohite
ashishmohite

Reputation: 1120

Add this line in activity tag inside manifest.xml file

android:windowSoftInputMode=adjustPan

for more you can refer :Android Documentation

Upvotes: 2

The Heist
The Heist

Reputation: 1442

Please try with this line in your manifest.xml file:

 android:windowSoftInputMode=adjustPan|adjustResize

Upvotes: 2

Related Questions