首页 > 解决方案 > AndroidStudio 4 说 enterPictureInPicture 自 API 26 起已弃用 - 这是不正确的,对吧?

问题描述

显示警告的 AndroidStudio 屏幕截图:

在此处输入图像描述

然而我在这里发现的是:

Android 8.0 (API level 26) allows activities to launch in picture-in-picture (PIP) mode.
PIP is a special type of multi-window mode mostly used for video playback. It lets the
user watch a video in a small window pinned to a corner of the screen while navigating
between apps or browsing content on the main screen.

我无法找到现在已弃用的地方。我错过了什么还是 AS 有错误?我想确保我没有在死路上编码。

标签: androidandroid-studioandroid-studio-4.0android-picture-in-picture

解决方案


enterPictureInPictureMode()在 API 24 中引入并在 API 26 中弃用。它已被 取代enterPictureInPictureMode(PictureInPictureParams),在 API 26 中引入。

此处的文档:https://developer.android.com/reference/android/app/Activity#enterPictureInPictureMode(android.app.PictureInPictureParams)


推荐阅读