分享应用界面
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 上的媒体投影功能可让用户与其他用户分享自己的设备显示屏。在 Android 14 QPR2 中,用户可以共享或录制应用窗口,而不是整个设备屏幕。
应用屏幕共享功能可让用户运行多个应用,但限制内容共享只能在一个应用中进行,从而提高隐私保护水平、提升用户工作效率并增强多任务处理能力。
通过应用屏幕共享,状态栏、导航栏、通知和其他系统界面元素不会显示在共享屏幕中。系统只会分享所选应用的内容。
使用 MediaProjection
API 的应用能够自动进行应用屏幕共享。不过,请测试您的应用,以确保应用屏幕共享功能按预期运行。
Android 14(API 级别 34)添加了以下媒体投影回调方法,可用于自定义应用屏幕共享:
使用新方法来提升应用屏幕共享用户体验。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# App screen sharing\n\nMedia projection on Android enables users to share their device display with other users. On Android 14 QPR2, users can share or record an app window rather than the entire device screen.\n\nApp screen sharing increases privacy, improves user productivity, and enhances multitasking by enabling users to run multiple apps but restrict content sharing to a single app.\n\nWith app screen sharing, the status bar, navigation bar, notifications, and other system UI elements are excluded from the shared display. Only the content of the selected app is shared.\n\nApps that use the [`MediaProjection`](/reference/kotlin/android/media/projection/MediaProjection) APIs are capable of app screen sharing automatically. However, test your app to ensure app screen sharing works as intended.\n\n### `MediaProjection` callbacks\n\nAndroid 14 (API level 34) added the following media projection callback methods which enable you to customize app screen sharing:\n\n- [**`MediaProjection.Callback#onCapturedContentResize()`**](/reference/kotlin/android/media/projection/MediaProjection.Callback#oncapturedcontentresize)\n\n Enables resizing of the shared projection based on the size of the captured display area.\n- [**`MediaProjection.Callback#onCapturedContentVisibilityChanged()`**](/reference/kotlin/android/media/projection/MediaProjection.Callback#oncapturedcontentvisibilitychanged)\n\n Informs the shared projection host app of the visibility of the capture content. The host app can show or hide the captured content on the output surface based on whether the captured region is visible to the user. For example, in multi‑window mode, if another app completely covers the shared app, the host can hide the shared app on the output surface.\n\nUse the new methods to enhance the app screen sharing user experience."]]