【发布时间】:2015-08-07 08:03:28
【问题描述】:
当出现软键盘供用户输入输入并覆盖应出现文本的 EditText 时,我遇到了这个典型问题。
我尝试了许多不同的“修复”和解决方案,但均未成功。我猜我的布局中有某种组合会导致这个问题。
现在在 AndroidManifest.xml 我有这行
<activity
android:screenOrientation="landscape"
android:windowSoftInputMode="adjustPan">
EditText 的布局如下,EditText 在底部
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbars = "vertical"
android:windowSoftInputMode="adjustPan|adjustResize">
<LinearLayout
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/cargoRoot"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:numColumns="auto_fit"
android:stretchMode="columnWidth" >
<LinearLayout
android:layout_height="wrap_content" android:layout_width="600dp"
android:orientation="vertical" >
<TextView style="@style/smalltext" />
<TextView
android:id="@+id/arrivalEta"
android:layout_height="wrap_content" android:layout_width="wrap_content" />
<TextView
android:text="@string/cargoComments"
style="@style/smalltext" />
<ScrollView android:id="@+id/scrollEditCargoComments"
android:layout_width="fill_parent" android:layout_height="142dp"
android:scrollbars="vertical">
<EditText
android:id="@+id/editCargoComments"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="@dimen/text_normal"
android:minLines="5"
android:imeOptions="actionDone"
android:imeActionLabel="@string/send"
android:inputType="textNoSuggestions" />
</ScrollView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
其他值得评论的事情是,在应用程序中提示用户输入 cmets 的某些点之前,我的这个 EditText 的可见性消失了。然后我将可见性更改为可见,当用户点击文本时,会出现软键盘。 它似乎隐藏了它背后的一切。没有进行调整大小或平移操作。
保存 EditText 的视图被 infalted 代码隐藏并插入到 PopupWindow 内的另一个视图中。
就像 MainActivity > PopupWindow > ViewFlipper > EditText
我想知道 PopupWindow 或 ViewFlipper 是否会给软键盘管理添加一些毒药。
提前致谢
【问题讨论】:
标签: android android-layout keyboard android-edittext