代码之家  ›  专栏  ›  技术社区  ›  Bostrot

PiP进入时避免活动娱乐

  •  1
  • Bostrot  · 技术社区  · 8 年前

    在切换到图片窗口中的图片时,是否有办法避免活动娱乐?

    基本上我这样称呼它:

    @Override
    protected void onUserLeaveHint() {
        if (Build.VERSION.SDK_INT > 24 && isInFullscreen) {
            MainActivity.this.enterPictureInPictureMode();
        }
        super.onUserLeaveHint();
    }
    

    活动总是重新加载,这导致等待时间更长。

    1 回复  |  直到 8 年前
        1
  •  4
  •   Gabe Sechan    8 年前

    从文档中-将其添加到清单中的活动中:

    android:resizeableActivity="true"
    android:supportsPictureInPicture="true"
    android:configChanges=
        "screenSize|smallestScreenSize|screenLayout|orientation"
    

    看见 https://developer.android.com/guide/topics/ui/picture-in-picture.html 有关更多详细信息