My Activity has one single line EditView, one multi-ine EditView and a Button. When I enter a long text inside the singleline EditView, the entire form along with the submit Button is moving to right. And I'm unable to submit the form. How can I fix this.
Thanks, nehatha
+++ Edit +++++++
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:background="@drawable/bg" android:orientation="vertical"
android:id="@+id/rootView">
<LinearLayout android:layout_width="fill_parent"
android:background="@color/Black" android:layout_height="1dip" />
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_gravity="center" android:layout_marginBottom="2dip"
android:paddingLeft="12dip" android:paddingRight="20dip"
android:paddingTop="15dip" android:stretchColumns="0">
<TableRow android:layout_marginBottom="5dip">
<ImageView android:id="@+id/img"
android:layout_width="270dip" android:layout_height="270dip">
</ImageView>
</TableRow>
<TableRow android:layout_marginBottom="5dip">
<EditText android:background="@android:drawable/editbox_background"
android:focusable="true" android:id="@+id/txtTitle"
android:hint="@string/hint_title" android:nextFocusDown="@+id/txtDesc"
android:imeOptions="actionNext" android:inputType="text"
android:textSize="6pt" android:layout_width="fill_parent"
/>
</TableRow>
<TableRow android:layout_marginBottom="5dip">
<TextView android:padding="3dip" android:textSize="18dip"
android:textColor="@color/registration_fields_title" android:text="Description" />
</TableRow>
<TableRow android:layout_marginBottom="5dip">
<EditText android:background="@android:drawable/editbox_background"
android:focusable="true" android:gravity="top" android:inputType="textMultiLine"
开发者_如何转开发 android:minLines="5" android:id="@+id/txtDesc"
android:nextFocusDown="@+id/btn_update" android:imeOptions="actionDone"
android:textSize="6pt" android:layout_width="fill_parent"
/>
</TableRow>
<TableRow android:layout_marginBottom="5dip">
<Button android:layout_width="wrap_content"
android:layout_gravity="center" android:layout_height="wrap_content"
android:textStyle="bold" android:textColor="@color/white"
android:clickable="true" android:background="@drawable/menu_button_border_shape"
android:layout_marginLeft="10px" android:text="Post"
android:id="@+id/btn_post"></Button>
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
If your EditText (not EditView) is increasing in size thats because its width is set to "wrap_content". Try setting the width to an absolute amount such as:
android:layout_width="fill_parent"
or
android:layout_width="100dip"
wrap_content
will always be the width of it's content.
Specify EditText width (e.g. as fill_parent
)
//try following code
//1)set height of your txtDesc id of EditText
//using fix height
android:id="@+id/txtDesc"
android:layout_height="70dp"
//or
//2) set height of your txtDesc id of EditText
//using wrap_content height
android:id="@+id/txtDesc"
android:layout_height="wrap_content"
精彩评论