工作中發(fā)現(xiàn)在AlertDialog中加入EditText后,軟鍵盤彈出時(shí)會(huì)遮擋住dialog斥赋,在網(wǎng)上結(jié)果一番搜索后得出解決方案,這里記錄一下产艾。
在styles.xml文件寫
<style name="dialog_soft_input" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:windowSoftInputMode">stateVisible|adjustPan</item>
</style>
然后將以上style設(shè)置進(jìn)dialog中疤剑,自定義的dialog可以直接寫在alertDialog的構(gòu)造器里
至此洛波,dialog能夠正常被彈起
測試機(jī)型:小米10pro MIUI12,如有問題骚露,歡迎指出。
image.png
image.png