Android: EditView движется вправо - PullRequest
0 голосов
/ 11 июля 2011

Моя активность имеет одну строку EditView, один многоуровневый EditView и кнопку. Когда я ввожу длинный текст внутри однострочного EditView, вся форма вместе с кнопкой отправки перемещается вправо. И я не могу отправить форму. Как я могу это исправить.

Спасибо, 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>

Ответы [ 3 ]

0 голосов
/ 11 июля 2011

Укажите ширину EditText (например, fill_parent)

0 голосов
/ 25 апреля 2013
//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"
0 голосов
/ 11 июля 2011

Если ваш EditText (не EditView) увеличивается в размере, потому что его ширина установлена ​​на "wrap_content". Попробуйте установить абсолютную величину ширины, например:

android:layout_width="fill_parent"

или

android:layout_width="100dip"

wrap_content всегда будет шириной содержимого.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...