Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

space between editText and softkeyboard

Tags:

android

xml

i have an activity with an editText field almost at the bottom. when i focus on that editText field the keyboard shows up and pushes my edittext field up.

when it stops there is no space between editText and my softkeyboard.

is it possible to add some margin?

this is my code:

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_yellow"
android:orientation="vertical"
>

<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_gravity="bottom"
    android:layout_alignParentBottom="true"
    android:paddingTop="25dp"
    >

    <RelativeLayout 
        android:layout_width="340dp"
        android:layout_height="100dp"
        android:layout_centerHorizontal="true"
        >

        <EditText 
            android:layout_width="340dp"
            android:layout_height="45dp"
            android:background="@drawable/edit_text_field"
            android:inputType="text"
             />

    </RelativeLayout>
</RelativeLayout>

position of editText field before keyboard shows up: http://postimg.org/image/826fwy18z/

and an image when keyboard is show up, with no space between cursor and keyboard: http://postimg.org/image/97qlfb4zx/

like image 463
Jan Verhagen Avatar asked Nov 15 '13 20:11

Jan Verhagen


1 Answers

You can use android:windowSoftInputMode property of Activity in manifest file.

Use android:windowSoftInputMode="adjustResize" in your case. You can check other properties as well.

Hope this helps.

Thanks.

like image 103
Zealous System Avatar answered Oct 23 '22 21:10

Zealous System