簡體   English   中英

如何使鍵盤僅出現在 EditText 下方

[英]How to make Keyboard appear below the EditText ONLY

我試圖讓鍵盤只出現在EditText下方,使用AdjustPan ,我得到了這個:

我試圖隱藏鍵盤的建議部分,但沒有幫助, EditText的一部分仍然隱藏在鍵盤下。

我正在使用下面的代碼:

<style name="DialogStyle" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="android:windowIsFloating">false</item>
    <item name="android:windowSoftInputMode">adjustPan</item>
</style>

編輯文本:

<EditText
        android:id="@+id/edit_query"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_margin="8dp"
        android:background="@drawable/edit_bg"
        android:hint="@string/enter_your_text"
        android:imeOptions="actionDone"
        android:inputType="text|textNoSuggestions"
        android:maxLength="250"
        android:maxLines="1"
        android:paddingStart="8dp"
        android:paddingEnd="8dp"
        android:singleLine="true"
        android:textColor="@color/black"
        android:textSize="12sp"
        android:textStyle="normal" />

我只希望鍵盤正好在EditText下方。

謝謝你。

嘗試這個

<item name="android:windowSoftInputMode">adjustResize</item>

當你想創建你的對話框時

    setStyle(DialogFragment.STYLE_NORMAL, R.style.DialogStyle)

暫無
暫無

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

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