У меня возникла странная проблема с некоторыми телефонами с различными клавиатурами с клавиатурой Google/Samsung, о которых мне было интересно, если кто-то столкнулся и имел решение.Проблема с функцией перерисовки мягкой клавиатуры
Проблема, с которой я сталкиваюсь, заключается в следующем: если я использую клавиатуру Google или Samsung галактики, мой макет (ниже) отлично работает, мгновенно и нет никаких лаг. Я тестировал это на многих устройствах (Galaxy S3, Galaxy Note, Galaxy S5, Nexus 5, 6 и 7). Если я запускаю это на HTC или телефоне LG, с другой стороны, с их клавиатурой по умолчанию, макет имеет заметное отставание, когда пользователи вводят текст.
После множества отладочных и измерительных измерений я выяснил, что проблема связана с панелью предложений. Для стандартных клавиатур Samsung/Google панель предложений всегда присутствует (показана ниже), но для телефонов HTC/LG панель предложений становится видимой только после того, как пользователь набирает что-то, что вызывает повторную визуализацию макета. Этот повторный рендеринг в свою очередь вызывает заметное отставание, когда пользователь начинает печатать. Я пробовал много и много решений, найденных здесь на SO, таких как упаковка моих макетов в LinearLayout и фиксация их ширины (путем указания весов) и фиксации высот других элементов управления и т. Д. (Все они видны в файле макета ниже), чтобы удалить бремя измерения измерений макета, но ни один из них не удалил это отставание.
Мой вопрос: как я могу исправить эту проблему? Есть ли способ заставить ВСЕ клавиатуру всегда показывать эту панель подсказок, независимо от того, что пользователь может или не может вводить какой-либо текст? Для меня не вариант заставить моих пользователей выбрать определенную клавиатуру, иначе они столкнутся со значительным отставанием.
Мой макет простой макет с горизонтальной точки зрения прокрутки и двумя редактирования текстов:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/editText_topic"
android:textSize="@dimen/txt_description_font_size" />
<HorizontalScrollView
android:id="@+id/layout_topics"
android:layout_width="match_parent"
android:layout_height="@dimen/gallery_height"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="2dp"
android:background="@drawable/rectangle_error_background"
android:paddingLeft="6dp"
android:paddingRight="6dp" >
<LinearLayout
android:id="@+id/gallery_topic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="horizontal" />
</HorizontalScrollView>
<RelativeLayout
android:id="@+id/layout_title_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="8dp" >
<TextView
android:id="@+id/txt_title_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="@dimen/length_text_font_size" >
</TextView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/txt_title"
android:layout_width="0dp"
android:layout_height="@dimen/txt_input_height"
android:layout_gravity="fill_horizontal|fill_vertical"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:hint="@string/editText_title_hint"
android:inputType="textFilter|textCapSentences" >
<requestFocus
android:layout_width="match_parent"
android:layout_height="match_parent" />
</EditText>
</LinearLayout>
<RelativeLayout
android:id="@+id/layout_description_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="8dp" >
<TextView
android:id="@+id/txt_description_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="@dimen/length_text_font_size" >
</TextView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/txt_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:gravity="top"
android:hint="@string/editText_description_hint"
android:inputType="textAutoCorrect|textCapSentences|textMultiLine"
android:scrollbars="vertical" >
</EditText>
</LinearLayout>
</LinearLayout>
Деятельность в манифесте заключается в следующем:
<activity
android:name="MyActivity"
android:icon="@drawable/whatever"
android:label="@string/empty"
android:parentActivityName="ParentActivity"
android:theme="@style/MyTheme"
android:windowSoftInputMode="adjustResize|stateVisible" >
</activity>
Обновление: Я заметил, что WhatsApp всегда показывает эту панель предложений на клавиатуре, даже если вход EditText пуст (пользователь еще не ввел значение). Кто-нибудь знает, как это делается?
Большое спасибо заранее.
HTC по умолчанию имеет очень агрессивное энергосбережение. Вы пытались отключить энергосбережение? –