Csabi
Csabi

Reputation: 3043

Make bottom of the screen appear above keyboard

Hi I am developing a multiline EditText which has 3 lines. And the keyboard always appears below the cursor, but I want to always show the whole 3 lines even if I'm writing in the first one. So I need a way to put the bottom of the view(screen/layout) on the top of the keyboard.

Now I use a simple EditText with 3 lines and flag that is multiline.

    <EditText
        android:id="@+id/editTextMessage"
        android:layout_width="0dip"
        android:layout_height="match_parent"
        android:layout_marginBottom="2dp"
        android:layout_marginLeft="10dp"
        android:layout_weight="0.7"
        android:background="@drawable/button_background"
        android:ems="10"
        android:gravity="top|left"
        android:hint="Message"
        android:inputType="textMultiLine"
        android:lines="3"
        android:maxLength="140"
        android:paddingLeft="5dip"
        android:paddingRight="5dip"
        android:paddingTop="5dip"
        android:textColorHint="@color/JLGreyDarkSend"
        android:textSize="14sp">

Upvotes: 2

Views: 904

Answers (3)

GGCoke
GGCoke

Reputation: 556

You can try to set android:windowSoftInputMode="adjustResize" to the activity.

Upvotes: 4

Anoop M Maddasseri
Anoop M Maddasseri

Reputation: 10549

You have to play with the windowSoftInputMode. See developer docs for more discussion.

Upvotes: 1

orelzion
orelzion

Reputation: 2532

You can try to wrap your content into a ScrollView, that way it should push your layout up when using keyboard

Upvotes: 2

Related Questions