Språk

WindowManagerLayoutParams.SetCanChangeGlobalTouchMode(Boolean) Method

Definition

Sets the TouchMode state of the window.

[Android.Runtime.Register("setCanChangeGlobalTouchMode", "(Z)V", "GetSetCanChangeGlobalTouchMode_ZHandler", ApiSince=37)]
public virtual void SetCanChangeGlobalTouchMode(bool canChangeGlobalTouchMode);
[<Android.Runtime.Register("setCanChangeGlobalTouchMode", "(Z)V", "GetSetCanChangeGlobalTouchMode_ZHandler", ApiSince=37)>]
abstract member SetCanChangeGlobalTouchMode : bool -> unit
override this.SetCanChangeGlobalTouchMode : bool -> unit

Parameters

canChangeGlobalTouchMode
Boolean

whether the window should control the TouchMode state.

Attributes

Remarks

Sets the TouchMode state of the window. This is specifically for IMEs that want to change the global Touchmode state at runtime, will otherwise do a no-op for all other apps.

Note: This property is currently only supported for windows of type WindowManager.LayoutParams.TYPE_INPUT_METHOD. Setting this on other window types is a no-op.

By default, this is set to true in which the window can set the TouchMode state through interactions (touch/mouse/touchpad). This is only necessary if this window was previously called with false.

If set to false, user interactions within this window will not modify the global TouchMode state. This is particularly useful for accessibility on-screen keyboards that wish to avoid clearing the focus of the application they are interacting with.

Recommended use case: IMEs with WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE that do not receive any focus may want to set this to false to ensure that the application bound to the IME does not destroy its focus when interacting with the IME via touch/mouse/touchpad.

Important: TouchMode is a global system synchronized state that applies to all windows. If this is set to false, TouchMode will no longer be a global synchronized state as this window no longer subscribes to TouchMode state changes until either the window is closed or this is set to true.

Android reference for android.view.WindowManager.LayoutParams.setCanChangeGlobalTouchMode.

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.

Applies to