Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move up the whole layout when keyboard shown?

Tags:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

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

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content" /> 
        </LinearLayout>    

</FrameLayout>  

in manifest:

 android:windowSoftInputMode="adjustPan"

Initial behavior:

enter image description here

Current behavior:

enter image description here

Desired behavior:

enter image description here

How to achive desired behavior of layout? adjustResize unsuitable because this option resizes layout.

Thank you for answers!

like image 561
Sinigami Avatar asked Dec 17 '14 15:12

Sinigami


People also ask

How do I scroll up layout when clicking on Edittext?

try this android:windowSoftInputMode="adjustResize" in your activity in manifest file.


Video Answer


2 Answers

The only way to obtain that result is resize layout. Use android:windowSoftInputMode="adjustResize"

like image 154
dledo Avatar answered Sep 26 '22 15:09

dledo


You probably want to take a look at this answer. A suggestion from it:

Set Window SoftInput Mode property to adjustPan and adjustResize

<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity>
like image 24
Andrew Orobator Avatar answered Sep 25 '22 15:09

Andrew Orobator