Kotlin

アクティビティでピクチャー・イン・ピクチャーを有効にする

ビデオ通話をホストするアクティビティで、PiP とサイズ変更属性を設定し、PiP に入るときにアクティビティが再作成されないように設定変更を処理します:

<activity
    android:name=".MainActivity"
    android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
    android:exported="true"
    android:resizeableActivity="true"
    android:supportsPictureInPicture="true"
    android:theme="@style/Theme.PictureInPicture">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
属性 目的
supportsPictureInPicture この活動がPiPに入る可能性があることを宣言する
resizeableActivity 多くのデバイスでのマルチウィンドウ/PiPに必要
configChanges PiPのサイズ/方向性の変化に関する活動を破壊することを避ける