Android EditText Hidden - PullRequest
       1

Android EditText Hidden

2 голосов
/ 23 ноября 2011

В Android у меня есть родитель RelativeLayout.Внутри, что у меня есть, ScrollView -> TableLayout

TableLayout содержит около 25 комбинаций элементов формы (TextView : EditText).

Проблема заключается в том, когдаEditText выбран, клавиатура SoftInput скрывает EditText, и, следовательно, пользователь не может видеть, где он печатает текст.

Пример файла макета.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:background="#FFFFFF"
 android:gravity="fill"
 android:orientation="vertical" >

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/retailinfoscroller"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_below="@+id/logininputtime"
 android:layout_marginTop="10dip"
 android:scrollbars="vertical" >

<TableLayout
 android:id="@+id/newstoreregtable"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:fadeScrollbars="true"
 android:stretchColumns="1" >

 <TableRow >

 <TextView
 android:layout_width="120dip"
 android:layout_gravity="center_vertical"
 android:layout_marginBottom="5dip"
 android:layout_marginLeft="10dip"
 android:layout_marginTop="5dip"
 android:gravity="right"
 android:text="@string/strretailerid"
 android:textColor="#000000"
 android:textSize="16dip" />

 <EditText
 android:id="@+id/editretailerid"
 android:layout_width="120dip"
 android:layout_height="45dip"
 android:layout_marginLeft="5dip"
 android:layout_marginRight="5dip"
 android:layout_marginTop="5dip"
 android:layout_weight="0.6"
 android:background="@drawable/edittextsample"
 android:clickable="false"
 android:cursorVisible="false"
 android:editable="false"
 android:singleLine="true" >
 </EditText>
 </TableRow>

 <TableRow></TableRow>
 </TableLayout>
 </ScrollView>
 </RelativeLayout>

По сути, я просто хочу, чтобы мой EditText был виден всякий раз, когда пользователь хочет ввести.

Я прошел через форум,но не могу найти решение.

Ответы [ 2 ]

4 голосов
/ 23 ноября 2011

В манифесте добавьте android:windowSoftInputMode="adjustResize" под тегом Activity ..

1 голос
/ 23 ноября 2011

В файле манифеста Android:

android:windowSoftInputMode="stateVisible|adjustResize|adjustPan"

Также вам нужно добавить следующий код в функцию OnCreate действия:

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

Надеюсь, это поможет .....

...