Inf*_*eus 5 keyboard android rotation fragment
我有一个带有列表视图和编辑文本的聊天片段,我想当用户旋转设备时,如果显示了键盘,它仍然显示。但在我的片段上,如果用户从横向旋转到纵向并且键盘打开,它会重新显示为打开。但从纵向到横向,它会关闭旋转。我不知道会发生什么以及如何保存键盘状态来恢复它。提前致谢。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="vertical" >
<com.example.irclient2.adapter.MyEditText
android:id="@+id/chatinput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:imeOptions="actionSend|flagNoExtractUi"
android:inputType="textCapSentences" />
<ListView
android:id="@+id/chatlist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/chatinput"
android:background="@drawable/fundo_chat"
android:divider="@android:color/transparent"
android:dividerHeight="1.0sp"
android:padding="5dp"
android:scrollingCache="false"
android:smoothScrollbar="true"
android:transcriptMode="normal" >
</ListView>
Run Code Online (Sandbox Code Playgroud)