WindowManagerLayoutParams.SetKeyboardCaptureEnabled(Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Allows the currently focused window to capture keys before system processes system shortcuts and actions.
[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
Parameters
- enabled
- Boolean
whether the window should capture system shortcuts and actions.
- Attributes
Remarks
Allows the currently focused window to capture keys before system processes system shortcuts and actions.
This will allow the application to receive keys before the system processes system shortcuts and actions. But certain system keys (Power keys, etc.) and shortcuts can be reserved and can never be blocked by the current focused window even with "keyboard capture" on.
Window which set this attribute to true, but doesn't have the required permission will not be allowed to capture system shortcuts and actions. No exception will be thrown due to missing permission, we will just fallback to the default behavior of processing system shortcuts and actions.
Java documentation for android.view.WindowManager.LayoutParams.setKeyboardCaptureEnabled(boolean).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.