Honeycomb (3.1) adjustResize no longer working?
My activity has android:windowSoftInputMode="adjustResize" and behaves accordingly in Android 2.1:
Before soft keyboard appears
With keyboard
However, in Honeycomb the soft keyboard does not resize my layout, it instead covers the buttons:
Same behavior on both the 10 in开发者_开发知识库ch Galaxy tab and the Motorola Xoom.
I've reworked my layout several times trying to get it to be compatible with Honeycomb, to no avail. The soft keyboard will push up an EditText view, but not the buttons.
Here is a simple app project demonstrating the problem.
Edit: Link fixed.
The layout used:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save" />
<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
</ScrollView>
</RelativeLayout>
The only related issue I've found is this, but disabling hardware acceleration had no effect for me. I also read the Android guide on making your app compatible with input methods, but didn't recognize any solution there.
Am I doing something obviously wrong? Or is this a bug anyone has more info on?
Hi I have checked your code.
please remove below line in "AndroidManifest.xml"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
and then check then adjust size your screen.
If any query plz let me know.
The adjustResize mode definitely works; you will see it in action throughout the UI.
So the question is: why is it not being set for your app?
First thing you can use "adb shell dumpsys window" to see the information about your window, which will include the soft input mode being set by its WindowManager.LayoutParams. The value printed there is the raw number; look here for its meaning: http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#SOFT_INPUT_ADJUST_NOTHING
If your window does not actually have adjustResize there, then you'll need to dig in and see why that is not getting set. Everything else being normal, if you set that mode on the activity it will be set on the window like always. You'll want to look for something else you are doing that is causing it to be changed in your window.
If your window does have adjustResize selected, then for some reason your view hierarchy is not actually resizing. There are no major differences I know of in the platform that could cause this to not work (and again you can see that it does work elsewhere in the stock UI). The first thing I would suggest doing here is using HierarchyViewer to see what is happening in your view hierarchy.
adjustResize will fail when your activity is in fullscreen mode, as tracked here: https://code.google.com/p/android/issues/detail?id=5497&can=1&q=honeycomb%20fullscreen&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
I found a workaround which worked for me, you might want to try out: https://stackoverflow.com/a/19494006/1241783
Cheers
精彩评论