I’m developing application which needs to have functionality similer like built in Android SMS messenger.
I tried to do the following:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="fill_parent"
a:layout_height="fill_parent">
<LinearLayout
a:orientation="vertical"
a:layout_height="wrap_content"
a:layout_width="fill_parent">
<EditText
a:id="@+id/smsRecipients"
a:layout_height="wrap_content"
a:layout_width="fill_parent"
a:hint="@string/sms_to_whom"/>
<Button
a:layout_height="wrap_content"
a:layout_width="fill_parent"
a:text="@string/sms_contacts"
/>
</LinearLayout>
<LinearLayout a:layout_alignParentBottom="true"
a:orientation="horizontal"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:paddingTop="5dip"
a:paddingBottom="5dip"
a:paddingLeft="5dip"
a:paddingRight="5dip"
a:background="#dcdcdc">
<EditText
a:id="@+id/smsBody"
a:layout_width="0dip"
a:layout_height="wrap_content"
a:layout_weight="1.0"
a:autoText="true"
a:capitalize="sentences"
a:nextFocusRight="@+id/send_button"
a:hint="@string/sms_enter_message"
a:maxLines="10"
a:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
a:imeOptions="actionSend|flagNoEnterAction"/>
<LinearLayout a:orientation="vertical" a:layout_width="wrap_content" a:layout_height="fill_parent">
<Button
a:id="@+id/smsSendButton"
a:layout_marginLeft="5dip"
a:layout_width="wrap_content"
a:layout_height="0dip"
a:layout_weight="1.0"
a:nextFocusLeft="@+id/smsBody"
a:text="@string/sms_send_abbr"
a:enabled="false"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
it works fine, except that as the EditText get expanded in more than 1 line, also button get expanded too.
So how to make the height of button fixed?
Means that it will automatically resize, try setting it to wrap_content