Taz*_*azz 17 android android-softkeyboard
我正在尝试关闭在另一个应用程序中打开的软键盘.我从这里尝试了所有解决方案:以 编程方式隐藏/显示Android软键盘或此处:关闭/隐藏Android软键盘
正如你在图片中看到我必须关闭从另一个应用程序打开的键盘,添加到清单,不要让键盘可见不起作用.
要注意这是一个更衣室应用程序,我会在手机进入睡眠模式时启动一项活动.
我错过了什么吗?从商店测试其他更衣室应用程序并没有遇到此问题
但结果如下:

编辑:更多信息
这是我启动储物柜的方式:
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//Toast.makeText(context, "" + "screeen off", Toast.LENGTH_SHORT).show();
wasScreenOn = false;
Intent intent = new Intent(context, LockScreenActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(intent);
// do whatever you need to do here
//wasScreenOn = false;
}
Run Code Online (Sandbox Code Playgroud)
这是清单代码:
<activity
android:name=".ui.activities.LockScreenActivity"
android:excludeFromRecents="true"
android:noHistory="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
Run Code Online (Sandbox Code Playgroud)
我终于解决了这个问题。这就是我的活动清单代码的样子:
<activity
android:name=".ui.activities.LockScreenActivity"
android:excludeFromRecents="true"
android:noHistory="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden"
android:configChanges="keyboardHidden"
android:launchMode="singleInstance"
android:multiprocess="false"
android:stateNotNeeded="true"
android:taskAffinity=""
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
321 次 |
| 最近记录: |