I am having an activity in android where there is an editbox and 3 buttons below the editbox. Please see attachment. When this activity is launched, the default state is STATE1.(Please see image). The keyboard is visible by default. Now when I press the back button or dispose the keyboard, I wish to have the edittext resized and occupy the whole screen as shown in STATE2.
I am not sure how to accomplish this. I have the height of the edittext hardcoded to some dp based on the target device. I believe this has to be changed. Can anyone help me in how to accomplish this.
The XML of the layout file is below as well as the screencap
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/EditMessage"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:background="@drawable/newback"
android:gravity="top"
android:imeOptions="actionDone"
android:inputType="textMultiLine|textFilter|textVisiblePassword|textNoSuggestions"
android:maxLength="200"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/PostMessage"
android:layout_width="0dp"
android:layout_height="45dp"
android:layout_weight="1"
android:layout_marginRight="0.2dp"
android:background="@drawable/newbutton_corner"
android:text="@string/SubmitMessage"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<Button
android:id="@+id/CancelMessage"
android:layout_width="0dp"
android:layout_height="45dp"
android:layout_weight="1"
android:layout_marginRight="0.2dp"
android:background="@drawable/newbutton_corner"
android:text="@string/CancelMessage"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<Button
android:id="@+id/DeleteMessage"
android:layout_width="0dp"
android:layout_height="45dp"
android:layout_weight="1"
android:background="@drawable/newbutton_corner"
android:text="@string/DeleteMessage"
android:textColor="#FFFFFF"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
