21
<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!

M S Gadag
  • 2,057
  • 1
  • 12
  • 15
Sinigami
  • 449
  • 3
  • 20
  • 38
  • I think you should use a scroll view as the main parent layout – Jamil Dec 27 '14 at 08:15
  • I'm sorry, but I don't get your intention. Say there were another two buttons above and below the text view;what would your desired behaviour be? If everything moves up, how is that not adjustResize ? – Anudeep Bulla Dec 27 '14 at 11:46

9 Answers9

2

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

dledo
  • 44
  • 3
2

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>
Community
  • 1
  • 1
Andrew Orobator
  • 7,978
  • 3
  • 36
  • 36
2

try this one in your manifest:

android:windowSoftInputMode="adjustResize|stateUnchanged"
Rathan Kumar
  • 2,567
  • 2
  • 17
  • 24
1

the check if the layout that contain EditText and Button is RelativeLayout.

Liran Peretz
  • 580
  • 8
  • 11
1

Try to change FrameLayout to RelativeLayout with alignParentBottom="true" property in your LinearLayout:

<RelativeLayout 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_alignParentBottom="true"
        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>    

</RelativeLayout>  
romtsn
  • 11,704
  • 2
  • 31
  • 49
1

You won't be able to implement that with adjustPan, because from the official guide

The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.

Your Button is below your current focus EditText

gio
  • 4,950
  • 3
  • 32
  • 46
1

by removing below line from activity and android:windowSoftInputMode from manifest, I got whole layout scrolling which was previously hiding by

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

please check this output video link: https://mega.nz/#!TpRCWZjY!TqDzv0Yn3Q24PR1JAdH8kRVeDf2iSa1LQbNBgF0SVHk

Chirag Jain
  • 628
  • 11
  • 24
1

I don't believe there is a simple way to do this. At least not as simple as setting a flag. I had a similar situation of wanting the keyboard to rise to the level of Views well below the selected EditText. I ended up using this answer: How to check visibility of software keyboard in Android?

and manually adjusting my View sizes when the keyboard becomes visible.

Community
  • 1
  • 1
Graydyn Young
  • 5,041
  • 1
  • 17
  • 19
0

Just use this property in activity

android:windowSoftInputMode="adjustPan"
Harv
  • 446
  • 5
  • 12