How does Android determine whether to move the layout when the on-screen keyboard is displayed?

How does Android determine whether to move the layout when the on-screen keyboard is displayed?

Note. I know that the activity property android:windowSoftInputMode="adjustResize|adjustResize|adjustUnspecified" exists as described here http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft , but in my case this does not seem to have any effect. It is my problem:

I have two actions, almost the same layout, but the first uses a ListView that contains a list of buttons . The second action contains a scroll with buttons . The rest is the same, the same number of buttons, the same height of the elements, etc.

Now, when I click the search button to open the search input panel, in my first action all the layouts move up. During the second action, the layout does not move up, and the on-screen keyboard is simply displayed on top of it. This is actually the way I want him to behave. How can I achieve the same with my activity as with ListView?

In my manifest, initially I did not specify any android:windowSoftInputMode , but even if I do, it does not matter; I tried all three values ​​(adjustPan, adjustResize, adjustUndefined, without any differences).

This is my layout:

1) http://pastebin.com/5zzVxjbK

2) http://pastebin.com/KFtPuHvP

Interesting, however: when I set the ListView visibility in my layout 1 (left) to View.INVISIBLE, then the layout will not be moved up!

alt text

+6
android android-manifest
source share
1 answer

I can achieve this using RelativeLayout and setting android:windowSoftInputMode="adjustPan" as follows:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <include android:id="@+id/Header" layout="@layout/header" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/Header" android:layout_above="@+id/Footer" /> <include android:id="@id/Footer" layout="@layout/footer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" /> </RelativeLayout> 

You may be able to achieve this by setting the gravity of the footer (or layout_gravity) to β€œfooter” if you want to keep LinearLayout, but I'm not sure.

0
source share

All Articles