[英]Hidden EditText when soft keyboard appears
當出現軟鍵盤供用戶輸入輸入並覆蓋應出現文本的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>
其他值得評論的是,我的EditText的可見性消失了,直到應用程序中提示用戶輸入評論的某些點為止。 然后,我將可見性更改為“可見”,並且當用戶點擊文本時,出現軟鍵盤。 似乎隱藏了所有內容。 沒有調整大小或平移操作。
包含EditText的視圖位於代碼后面,並插入到PopupWindow內的另一個視圖中。
所以就像MainActivity> PopupWindow> ViewFlipper> EditText
我想知道PopupWindow或ViewFlipper是否會給軟鍵盤管理添加一些毒葯。
提前致謝
嘗試這個:
android:windowSoftInputMode =“ adjustResize | adjustPan | stateHidden”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.