简体   繁体   中英

Android EditText Layout like Gmail Compose Screen

I am trying to implement the following:

Please check the image here:

在此输入图像描述

The problem is whenever the user taps the compose mail edittext field, the send/save/discard buttons are hidden by the softkeyboard.

Any ideas on how to make those buttons always visible? Thanks.

[EDIT] Finally got it solved!Had to use Linearlayout instead of RelativeLayout and assigning proper layout_weight parameter did the trick. Thanks a lot Femi for pointing out that the buttons need to be outside of the ScrollView.

Here is the final working layout xml in case anyone finds it helpful:

<?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"><ScrollView android:layout_alignParentTop="true" 
    android:layout_weight="1"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
    <RelativeLayout 
        android:id="@+id/InnerRelativeLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" >
        <EditText 
            android:id="@+id/editTextCompose" 
            android:layout_width="fill_parent"
            android:layout_height="200dp"
            android:gravity="top"
            android:singleLine="false" android:lines="5"
            android:inputType="text"
            android:layout_below="@+id/editTextSubject"
            >
        </EditText>
    </RelativeLayout>
</ScrollView><TableLayout android:id="@+id/recipeButtons" 
    android:background="#B0B0B0" android:padding="3dip" 
    android:stretchColumns="0,1" android:layout_alignParentBottom="true" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
    <TableRow android:gravity="center"> 
        <Button android:id="@+id/editOtherAdditionButton" 
            android:text="Save" /> 
        <Button android:id="@+id/removeOtherAdditionButton" 
            android:text="Delete" /> 
    </TableRow> 
</TableLayout></LinearLayout>

As documented in @mayra's answer to Android soft keyboard covers edittext field you should see http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft for the details to control.

Modifying the Activity's entry in the AndroidManifest to adjustResize should I think do it.

有关于这一个问题在这里 ,但它看起来像最好的办法是使用windowSoftInputMode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM