Sdílet prostřednictvím


Activity.RequestVisibleBehind(Boolean) Method

Definition

Activities that want to remain visible behind a translucent activity above them must call this method anytime between the start of #onResume() and the return from #onPause().

[Android.Runtime.Register("requestVisibleBehind", "(Z)Z", "GetRequestVisibleBehind_ZHandler")]
public virtual bool RequestVisibleBehind (bool visible);
[<Android.Runtime.Register("requestVisibleBehind", "(Z)Z", "GetRequestVisibleBehind_ZHandler")>]
abstract member RequestVisibleBehind : bool -> bool
override this.RequestVisibleBehind : bool -> bool

Parameters

visible
Boolean

true to notify the system that the activity wishes to be visible behind other translucent activities, false to indicate otherwise. Resources must be released when passing false to this method.

Returns

the resulting visibiity state. If true the activity will remain visible beyond #onPause() if the next activity is translucent or not fullscreen. If false then the activity may not count on being visible behind other translucent activities, and must stop any media playback and release resources. Returning false may occur in lieu of a call to #onVisibleBehindCanceled() so the return value must be checked.

Attributes

Remarks

Activities that want to remain visible behind a translucent activity above them must call this method anytime between the start of #onResume() and the return from #onPause(). If this call is successful then the activity will remain visible after #onPause() is called, and is allowed to continue playing media in the background.

The actions of this call are reset each time that this activity is brought to the front. That is, every time #onResume() is called the activity will be assumed to not have requested visible behind. Therefore, if you want this activity to continue to be visible in the background you must call this method again.

Only fullscreen opaque activities may make this call. I.e. this call is a nop for dialog and translucent activities.

Under all circumstances, the activity must stop playing and release resources prior to or within a call to #onVisibleBehindCanceled() or if this call returns false.

False will be returned any time this method is called between the return of onPause and the next call to onResume.

This member is deprecated. This method's functionality is no longer supported as of android.os.Build.VERSION_CODES#O and will be removed in a future release.

Java documentation for android.app.Activity.requestVisibleBehind(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

See also