单击可搜索微调器时键盘自动弹出
Keyboard automatically pops up when clicking searchable spinner
我正在使用 miteshpithadiya 的可搜索微调器 GitHub link 是
https://github.com/miteshpithadiya/SearchableSpinner
微调器运行良好,但单击微调器时软键盘不断弹出。
我想一直在寻找解决方案,但一直没有找到
我试过使用触摸事件,但 hat 只删除了可搜索的微调器功能并保留了默认的微调器
请推荐一个解决方案或其他可搜索的微调器
谢谢
你可以试试这个:
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
但是如果键盘仍然出现在点击微调器上,那么使用另一个可搜索的微调器可能会更好我使用了这个并且它工作得很好
implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
添加此样式 -
<style name="Theme.UserDialog" parent="@style/Theme.AppCompat.Dialog">
<item name="windowActionBar">false</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:itemBackground">@android:color/white</item>
<item name="android:tint">@android:color/black</item>
<item name="textColorAlertDialogListItem">@android:color/black</item>
<item name="android:editTextColor">@android:color/black</item>
<item name="android:focusable">false</item>
</style>
添加您的微调器 xml 部分。
我正在使用 miteshpithadiya 的可搜索微调器 GitHub link 是
https://github.com/miteshpithadiya/SearchableSpinner
微调器运行良好,但单击微调器时软键盘不断弹出。 我想一直在寻找解决方案,但一直没有找到
我试过使用触摸事件,但 hat 只删除了可搜索的微调器功能并保留了默认的微调器
请推荐一个解决方案或其他可搜索的微调器
谢谢
你可以试试这个:
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
但是如果键盘仍然出现在点击微调器上,那么使用另一个可搜索的微调器可能会更好我使用了这个并且它工作得很好
implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
添加此样式 -
<style name="Theme.UserDialog" parent="@style/Theme.AppCompat.Dialog">
<item name="windowActionBar">false</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:background">@android:color/white</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:itemBackground">@android:color/white</item>
<item name="android:tint">@android:color/black</item>
<item name="textColorAlertDialogListItem">@android:color/black</item>
<item name="android:editTextColor">@android:color/black</item>
<item name="android:focusable">false</item>
</style>
添加您的微调器 xml 部分。