7

I have a layout as below

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="1">
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content">
    <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    <Button android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    <Button android:text="Button" android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    <Button android:text="Button" android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
<ImageButton android:id="@+id/imageButton1" android:src="@android:drawable/stat_notify_sync_noanim" android:layout_height="fill_parent" android:layout_weight="1" android:layout_width="fill_parent"></ImageButton>
<EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="match_parent">
    <requestFocus></requestFocus>
</EditText>
</LinearLayout>

when the softkeyboard invoked by clicking on the edit text the whole layou is being pushed. Can i keep the buttons on the header fixed and let the imageview being pushed?? Because buttons are gonna act like navigation bar so it should be there even when the layout is being pushed up.

Before enter image description here

After enter image description here

Jay Mayu
  • 17,023
  • 32
  • 114
  • 148

3 Answers3

14

Out of all properties under android:windowSoftInputMode in manifest the only thing that worked is

android:windowSoftInputMode="adjustNothing"

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Ravi
  • 4,872
  • 8
  • 35
  • 46
12

Read article here: http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
You should add in manifest android:windowSoftInputMode="adjustResize" parameter to your activity tag.

EDITED: Proper flag is: android:windowSoftInputMode="adjustResize"

ania
  • 2,352
  • 1
  • 20
  • 20
  • android:windowSoftInputMode="adjustPan" doesn't help :( – Jay Mayu Aug 11 '11 at 04:40
  • 10
    Try `android:windowSoftInputMode="adjustNothing"`. [This link](http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode) should be helpful. – kibibyte Aug 11 '11 at 05:02
  • 1
    Please try: android:windowSoftInputMode="adjustResize", I've mistaken tags. This should work :) – ania Aug 11 '11 at 06:09
  • 8
    android:windowSoftInputMode="adjustNothing" is not a valid value exposed by the API - the project errors out with that. – Artem Russakovskii Oct 17 '11 at 21:27
  • 1
    Would be nice to edit your real answer so we don't have to look into the comments to get the right one. – oldergod Nov 12 '12 at 05:30
  • @ArtemRussakovskii Is this still the case? My app doesn't seem to error with it and it's working as needed. Only tested on HTC One with 4.1. – DeeV Jun 07 '13 at 01:16
  • In fact it was suggested by my IDE which is how I found it. – DeeV Jun 07 '13 at 01:17
5

In my AndroidManifest file, I added the the following code to the activity:

android:windowSoftInputMode="adjustPan"

HISTORY

Actually, I tried AdjustResize and AdjustNothing but it didn't work on my end so I tried other ways. I found this answer useful and hope it solves your problem as well! :)

princepiero
  • 1,287
  • 3
  • 15
  • 28