我的问题:从第二次软键盘在屏幕上显示开始,它完全遮住了我的 EditText。
在 AndroidManifest.xml 中指定了属性 android:windowSoftInputMode="adjustPan",但仅在第一次使用时有效。
我有以下布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="464dp"
android:gravity="top"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="10"
android:background="#E3E3E2"
android:gravity="top" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/addListText"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="10"
android:contentDescription="@string/addItemContentDescription"
android:gravity="bottom|center_horizontal"
android:inputType="textLongMessage"
android:textColor="#E3E3E2"
android:visibility="gone" />
<ImageButton
android:id="@+id/addTextListButton"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:contentDescription="@string/addItemButton"
android:scaleType="fitCenter"
android:src="@drawable/plus_add"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="bottom|center_horizontal"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<ImageButton
android:id="@+id/syncListsButton"
android:layout_width="64dp"
android:layout_height="match_parent"
android:src="@android:drawable/ic_popup_sync" />
<ImageButton
android:id="@+id/showOrHide"
android:layout_width="64dp"
android:layout_height="match_parent" />
<ImageButton
android:id="@+id/delListButton"
android:layout_width="64dp"
android:layout_height="match_parent"
android:src="@android:drawable/ic_menu_delete" />
</LinearLayout>
</LinearLayout>
"showOrHide" 按钮用于显示/隐藏 "addListText"/"addTextListButton" 组合。
当第一次显示 EditText 并点击它时,软键盘会出现在屏幕上,并且 "addListText"/"addTextListButton" 组合会正确地移动。但是当我隐藏键盘然后再次显示它时,键盘完全覆盖了我的 addListText 编辑框!
你有任何想法吗?我正在 Android 4.2.2 上进行测试。
请帮帮我!谢谢 :-)
编辑:我还尝试将第一个 LinearLayout 放入 ScrollView 中,但不起作用!