hkbd关闭时如何在有硬键盘的设备上显示软键盘?
我对我的第一个问题(已解决)有一个必然的问题,SO Android show softkeybard ...
滑动键盘关闭后,我希望我的活动在启动时显示键盘。
相同的清单应适用于我的活动的清单中设置的“stateVisible
”。我需要使用 InputMethodManger
编写任何显式代码吗?再次,我尝试了明显的方法和标志,但它不会在带有滑动键盘的手机上打开键盘。
为了方便起见,将清单复制到此处:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.android.studyIme"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".StudyImeActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysVisible|stateVisible">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I have the corollary question to my first (solved) question, SO Android show softkeybard ...
With the sliding keyboard closed, I want my activity to show the keyboard when it gets started.
The same manifest should apply with "stateVisible
" set in the manifest for my activity. Do I need any explicit code with the InputMethodManger
? Again, I have experimented with the obvious methods and flags, but it does not open the keyboard on the phones with sliding keyboards.
The manifest is copied here for convenience:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.android.studyIme"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".StudyImeActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysVisible|stateVisible">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的同事解决了这个问题。她没有试图强行展示,而是用“切换”方法演示了解决方案。
当然,您可能希望将其包含在键盘状态的配置检查中。
My colleague solved the issue. Instead of trying to force-show, she demonstrated the solution with the "toggle" method.
Of course, you might want to wrap this inside a configuration check of the state of the keyboard.