共用方式為


DevicePolicyManager.SetStatusBarDisabled(ComponentName, Boolean) Method

Definition

Called by device owner or profile owner of secondary users that is affiliated with the device to disable the status bar.

[Android.Runtime.Register("setStatusBarDisabled", "(Landroid/content/ComponentName;Z)Z", "GetSetStatusBarDisabled_Landroid_content_ComponentName_ZHandler", ApiSince=23)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_STATUS_BAR")]
public virtual bool SetStatusBarDisabled (Android.Content.ComponentName? admin, bool disabled);
[<Android.Runtime.Register("setStatusBarDisabled", "(Landroid/content/ComponentName;Z)Z", "GetSetStatusBarDisabled_Landroid_content_ComponentName_ZHandler", ApiSince=23)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_STATUS_BAR")>]
abstract member SetStatusBarDisabled : Android.Content.ComponentName * bool -> bool
override this.SetStatusBarDisabled : Android.Content.ComponentName * bool -> bool

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin.

disabled
Boolean

true disables the status bar, false reenables it.

Returns

false if attempting to disable the status bar failed. true otherwise.

Attributes

Remarks

Called by device owner or profile owner of secondary users that is affiliated with the device to disable the status bar. Disabling the status bar blocks notifications and quick settings.

<strong>Note:</strong> This method has no effect for LockTask mode. The behavior of the status bar in LockTask mode can be configured with #setLockTaskFeatures(ComponentName, int). Calls to this method when the device is in LockTask mode will be registered, but will only take effect when the device leaves LockTask mode.

This policy does not have any effect while on the lock screen, where the status bar will not be disabled. Using LockTask instead of this method is recommended.

Java documentation for android.app.admin.DevicePolicyManager.setStatusBarDisabled(android.content.ComponentName, 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.

Applies to