2

我们正在使用带有画中画(pip)功能的通话页面。

问题:
如果用户关闭 pip 弹出窗口(通过向下拖动关闭),我们无法检测到。在此处输入图像描述

如何检测图片窗口中的图片向下拖动以关闭?

更新:
设置画中画

// RemoteRenderLayout -> call preview layout. You can set anyone view
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

    Rational aspectRatio = new Rational(
        remoteRenderLayout.getWidth(), remoteRenderLayout.getHeight());
    PictureInPictureParams params = new PictureInPictureParams.Builder()
        .setAspectRatio(aspectRatio)
        .build();
    enterPictureInPictureMode(params);
}
else{

    enterPictureInPictureMode();
}
4

1 回答 1

1

当活动进入或退出画中画模式时,系统调用Activity.onPictureInPictureModeChanged()Fragment.onPictureInPictureModeChanged().

您可以在其中实现您的代码:

 override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean,
                                           newConfig: Configuration) {
    if (isInPictureInPictureMode) {
        // Hide the full-screen UI (controls, etc.) while in picture-in-picture mode.
    } else {
        // Restore the full-screen UI.
    }
}
于 2020-03-09T04:25:51.087 回答