语言

ActivityOptions.SetLaunchDisplayId(Int32) 方法

定义

设置应在其中启动活动的显示 ID。

[Android.Runtime.Register("setLaunchDisplayId", "(I)Landroid/app/ActivityOptions;", "GetSetLaunchDisplayId_IHandler", ApiSince=26)]
public virtual Android.App.ActivityOptions? SetLaunchDisplayId(int launchDisplayId);
[<Android.Runtime.Register("setLaunchDisplayId", "(I)Landroid/app/ActivityOptions;", "GetSetLaunchDisplayId_IHandler", ApiSince=26)>]
abstract member SetLaunchDisplayId : int -> Android.App.ActivityOptions
override this.SetLaunchDisplayId : int -> Android.App.ActivityOptions

参数

launchDisplayId
Int32

应在其中启动活动的显示 ID。

返回

this ActivityOptions 实例。

特性

注解

设置应在其中启动活动的显示 ID。 应用可以在公共显示器上启动活动,或显示应用已有活动的位置。 否则,尝试在 android.app.ActivityManager.isActivityStartAllowedOnDisplay(Context,int,Intent)返回 false(如专用显示器或提供无效的显示 ID)将导致异常。 在没有PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS的设备上,将忽略设置启动显示 ID。

Android 参考。android.app.ActivityOptions.setLaunchDisplayId

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于