簡體   English   中英

ListView中EdiTtext的焦點和軟鍵盤出現問題

[英]problems with focus and Softkeyboard of EdiTtext in ListView

我有兩個ListViews

android:layout_height="wrap_content"
android:id="@+id/containerLv"
android:background="@drawable/modify_task_master_fragment_style"
android:paddingBottom="6dp"
android:layout_margin="6dp">

<ListView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scrollbars="none"
    android:id="@+id/topListView"
    android:layout_alignParentRight="true" />
<ListView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/topListView"
    android:layout_marginRight="3dp"
    android:layout_marginLeft="3dp"
    android:divider="@drawable/divid"
    android:dividerHeight="1px"
    android:scrollbars="none"
    android:id="@+id/scrollListView"/>

我將動態EditText放到ListView中,當我開始鍵入時,焦點丟失了。 我了解了此問題並將其添加到我的活動中

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

此解決方案有所幫助,但是又出現了另一個問題-在Listview中創建新項目時,SoftKeyboard與我的editText重疊。 所以我看不到我在打字。

沒有SOFT_INPUT_ADJUST_PAN就沒有這樣的問題

在清單中包括:

android:windowSoftInputMode="adjustResize"

另外,我建議您將根目錄布局設為RelativeLayout。

希望它能對您有所幫助:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM