共用方式為


Activity.RequestFullscreenMode Method

Definition

Request to put the a freeform activity into fullscreen.

[Android.Runtime.Register("requestFullscreenMode", "(ILandroid/os/OutcomeReceiver;)V", "GetRequestFullscreenMode_ILandroid_os_OutcomeReceiver_Handler", ApiSince=34)]
public virtual void RequestFullscreenMode (Android.App.FullscreenModeRequest request, Android.OS.IOutcomeReceiver? approvalCallback);
[<Android.Runtime.Register("requestFullscreenMode", "(ILandroid/os/OutcomeReceiver;)V", "GetRequestFullscreenMode_ILandroid_os_OutcomeReceiver_Handler", ApiSince=34)>]
abstract member RequestFullscreenMode : Android.App.FullscreenModeRequest * Android.OS.IOutcomeReceiver -> unit
override this.RequestFullscreenMode : Android.App.FullscreenModeRequest * Android.OS.IOutcomeReceiver -> unit

Parameters

request
FullscreenModeRequest

Can be #FULLSCREEN_MODE_REQUEST_ENTER or #FULLSCREEN_MODE_REQUEST_EXIT to indicate this request is to get fullscreen or get restored.

approvalCallback
IOutcomeReceiver

Optional callback, use null when not necessary. When the request is approved or rejected, the callback will be triggered. This will happen before any configuration change. The callback will be dispatched on the main thread. If the request is rejected, the Throwable provided will be an IllegalStateException with a detailed message can be retrieved by Throwable#getMessage().

Attributes

Remarks

Request to put the a freeform activity into fullscreen. This will only be allowed if the activity is on a freeform display, such as a desktop device. The requester has to be the top-most activity of the focused display, and the request should be a response to a user input. When getting fullscreen and receiving corresponding #onConfigurationChanged(Configuration) and #onMultiWindowModeChanged(boolean, Configuration), the activity should relayout itself and the system bars' visibilities can be controlled as usual fullscreen apps.

Calling it again with the exit request can restore the activity to the previous status. This will only happen when it got into fullscreen through this API.

If an app wants to be in fullscreen always, it should claim as not being resizable by setting android:resizableActivity="false"https://developer.android.com/guide/topics/large-screens/multi-window-support#resizeableActivity instead of calling this API.

Java documentation for android.app.Activity.requestFullscreenMode(int, android.os.OutcomeReceiver<java.lang.Void, java.lang.Throwable>).

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