Как правильно переадресовать компоненты EditText с помощью мягкой клавиатуры с внутренней раскладкой без наложения? - PullRequest
1 голос
/ 25 ноября 2011

Я разрабатываю небольшую форму в рамках ExpandableListActivity для моего приложения, которая состоит из множества компонентов EditText, и большинство из них представляют собой числовые поля.

Чтобы улучшить удобство использования при заполнении, я поместил атрибут android:imeOptions="actionNext|actionDone" в каждый из этих EditTexts, чтобы каждый раз, когда пользователь нажимал Enter на программной клавиатуре, фокус перенаправлялся на следующее поле ввода.

Это работает, фокус идет дальше, но когда следующий EditText для фокусировки находится внутри другого LinearLayout, клавиатура не панорамируется, а ее внутренние поля фокусировки остаются перекрытыми клавиатурой.

Какие-либо входные данные о том, как я могу заставить это работать для этого внутреннего поля редактирования?

Вот макет:

<EditText
     android:imeOptions="actionNext|actionDone"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:numeric="integer" />

<TextView
    style="@android:style/TextAppearance.Medium"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="FC (bat/min):"
    android:textColor="@color/monthview_grid_color" />

<EditText
    android:imeOptions="actionNext|actionDone"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:numeric="integer" />

<TextView
    style="@android:style/TextAppearance.Medium"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="FR (inc/min):"
    android:textColor="@color/monthview_grid_color" />

<EditText
    android:imeOptions="actionNext|actionDone"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:numeric="integer" />

<TextView
    style="@android:style/TextAppearance.Medium"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="PA:"
    android:textColor="@color/monthview_grid_color" />

<LinearLayout
     android:imeOptions="actionNext|actionDone"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <EditText
        android:imeOptions="actionNext|actionDone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.0"
        android:numeric="integer" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="X" />

    <EditText
        android:imeOptions="actionNext|actionDone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.0"
        android:numeric="integer" />
</LinearLayout>

<TextView
    style="@android:style/TextAppearance.Medium"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Sat. (%):"
    android:textColor="@color/monthview_grid_color" />

<EditText
    android:imeOptions="actionNext|actionDone"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:numeric="integer" />

А вот отрывок из моего AndroidManifest.xml относительно связанной деятельности:

<activity android:name=".activities.FormActivity" android:windowSoftInputMode="adjustPan" />

1 Ответ

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

Вы можете попробовать установить андроид: nextFocusDown текста для редактирования над линейной планировкой. Вам нужны только actionNext и actionDone для последнего элемента.

Кроме того, числовое значение устарело, вместо него используйте inputType = "number".

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