Before writing this question I have read through the following answers/articles:
The Android soft keyboard is set by default to pan which means it will keep all the editable regions above the keyboard. However it does not pan enough. When I run it and press the edittext that is close to the bottom of the screen, the keyboard comes up and edittext is moved up but not enough to be able to see what is being typed in it. I have used/tried the following:
android:windowSoftInputMode="adjustPan"
in the manifest of the Activity. This made no difference. I have also tried putting values of adjustUnspecified
and adjustResize
too. None of them works.
<uses-sdk android:minSdkVersion="3" />
in the manifest file. My application is targetted for sdk 2.1 and above. Even though, I tried it and did not work.
Using a ScrollView. Does not work either.
Is there a way to manually manage how much "panning" does a keyboard do when a specific edittext is pressed.
Below is my xml file.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff">
<ImageView
android:id="@+id/header"
android:layout_width="320dip"
android:layout_height="86dip"
android:background="@drawable/header_bg">
</ImageView>
<ImageView
android:layout_width="320dip"
android:layout_height="200dip"
android:layout_alignParentBottom="true"
android:background="@drawable/bg1_btm">
</ImageView>
<TextView android:text="Hostname"
android:id="@+id/lbl_hostname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/header"/>
<TextView android:text="(Current)"
android:id="@+id/lbl_hostname_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/lbl_hostname"
android:layout_below="@id/header" />
<EditText android:text="EditText"
android:id="@+id/editText_hostname"
android:layout_below="@id/lbl_hostname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="25">
</EditText>
<TextView android:text="Registration URL"
android:id="@+id/lbl_registration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_hostname" />
<TextView android:text="(Current)"
android:id="@+id/lbl_registration_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_hostname"
android:layout_toRightOf="@id/lbl_registration" />
<TextView android:text="http://"
android:id="@+id/lbl_url_prefiz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lbl_registration"
android:paddingTop="10dip" />
<EditText android:text="EditText"
android:id="@+id/editText_registration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf ="@id/lbl_url_prefiz"
android:layout_below="@id/lbl_registration">
</EditText>
<TextView android:text="Chat"
android:id="@+id/lbl_chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_registration"/>
<TextView android:text="(Current)"
android:id="@+id/lbl_chat_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_registration"
android:layout_toRightOf="@id/lbl_chat"/>
<EditText android:text="EditText"
android:id="@+id/editText_chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lbl_chat">
</EditText>
<TextView android:text="SSID"
android:id="@+id/lbl_ssid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_chat" />
<TextView android:text="(Current)"
android:id="@+id/lbl_ssid_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText_chat"
android:layout_toRightOf="@id/lbl_ssid"
/>
<EditText android:text="EditText"
android:id="@+id/editText_ssid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lbl_ssid"
android:maxLines="1"
android:inputType="text"
android:layout_marginBottom="25dip">
</EditText>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ButtonSave"
android:text="Save"
android:layout_below="@id/editText_ssid"
android:layout_alignParentLeft="true">
</Button>
<Button android:text="Continue"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/ButtonContinue"
android:layout_below="@id/editText_ssid"
android:layout_alignParentRight="true">
</Button>
</RelativeLayout>
Try
android:windowSoftInputMode="adjustResize"
worked fine for me :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With