WindowManagerLayoutParams.SetKeyboardCaptureEnabled(Boolean) 方法

定义

允许当前聚焦窗口在系统处理系统快捷方式和操作之前捕获密钥。

[Android.Runtime.Register("setKeyboardCaptureEnabled", "(Z)V", "GetSetKeyboardCaptureEnabled_ZHandler", ApiSince=36)]
public virtual void SetKeyboardCaptureEnabled(bool enabled);
[<Android.Runtime.Register("setKeyboardCaptureEnabled", "(Z)V", "GetSetKeyboardCaptureEnabled_ZHandler", ApiSince=36)>]
abstract member SetKeyboardCaptureEnabled : bool -> unit
override this.SetKeyboardCaptureEnabled : bool -> unit

参数

enabled
Boolean

窗口是否应捕获系统快捷方式和操作。

属性

注解

允许当前聚焦窗口在系统处理系统快捷方式和操作之前捕获密钥。

这将允许应用程序在系统处理系统快捷方式和操作之前接收密钥。 但是,某些系统键(电源键等)和快捷方式可以保留,即使打开了“键盘捕获”,当前聚焦窗口也永远无法阻止。

将此属性 true设置为的窗口,但不允许具有所需权限来捕获系统快捷方式和操作。 由于缺少权限,不会引发异常,我们将仅回退到处理系统快捷方式和操作的默认行为。

Java文档android.view.WindowManager.LayoutParams.setKeyboardCaptureEnabled(boolean)

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于