изменить:
Мне нужно использовать клавиатуру, но она скрывает мой EditText
, мне нужно ее прокрутить, чтобы клавиатура не скрывала ее.
Я использую планшет Samsung.
Мой стиль:
parent="android:Theme.Holo.NoActionBar.Fullscreen"
Поля EditText
находятся в прокручиваемом виде, например:
Макет фрагмента:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<ScrollView
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_width="match_parent"
android:orientation="vertical">
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/depot_code"/>
<EditText
android:hint="@string/enter_depot_code"
android:id="@+id/etlocationId"
android:imeOptions="actionNext"
android:inputType="number"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="12"
android:singleLine="true">
<requestFocus/>
</EditText>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/name"/>
<EditText
android:hint="@string/enter_name"
android:id="@+id/etname"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="24"
android:singleLine="true"/>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/street"/>
<EditText
android:hint="@string/enter_street"
android:id="@+id/etstreet"
android:imeOptions="actionNext"
android:inputType="textPostalAddress"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="24"
android:singleLine="true"/>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/suburb"/>
<EditText
android:hint="@string/enter_suburb"
android:id="@+id/etsuburb"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="24"
android:singleLine="true"/>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/state"/>
<Spinner
android:focusable="true"
android:focusableInTouchMode="true"
android:id="@+id/spinner"
android:imeOptions="actionNext"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="fill_parent"
android:spinnerMode="dropdown"/>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/phone"/>
<EditText
android:hint="@string/enter_phone"
android:id="@+id/etphone"
android:imeOptions="actionDone"
android:inputType="phone"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="12"
android:singleLine="true"/>
<Button
android:id="@+id/btnadd"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/add"/>
</LinearLayout>
</ScrollView>
</FrameLayout>
Схема действий:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tech_controller"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
< .../ Layouts. ../>
<FrameLayout
android:id="@+id/second"
android:layout_height="match_parent"
android:layout_width="fill_parent"/>
</LinearLayout>
Схожие вопросы были заданы, но я не нашел ответа, который работает.
У меня есть проект, который использует много фрагментов, связанных с одним действием. В моем манифесте для моей деятельности:
android:windowSoftInputMode="stateHidden"
Некоторые фрагменты требуют ввода пользователем.
В макете фрагмента я использую:
Каждый фрагмент вложен следующим образом:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent" .../>
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<EditText
android:imeOptions="actionNext"
or
android:imeOptions="actionDone" .../>
Это хорошо работает. КРОМЕ клавиатура скрывает EditTexts, которые расположены ниже на странице.
Я читал это снова и снова:
http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions
Пробовал эти предложения, но клавиатура тогда видна, когда вызывается действие, чего я не хочу. Он также не работает. Может быть, потому что это фрагмент?
SoftKeyboard скрывает EditText
Android-клавиатура скрывает EditText
Я пытался разработать динамическое решение. Любая помощь приветствуется.
edit: это для использования на планшетах, и есть только одна опция клавиатуры с изменениями языка.
Изменить: МОЕ РЕШЕНИЕ
Я решил это, установив еще одну мягкую клавиатуру. https://code.google.com/p/softkeyboard/wiki/HowTo