最近、Androidでwebrtcを勉強しました。SurfaceView A を
クリックしてフルスクリーンにし、別のSurfaceView B を小さくするか、B をクリックしたいのですが、実行時に 2 つの異なる surfaceview の z オーダーを変更するのは難しいことがわかりました。
これが私のレイアウトです
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_main">
<org.webrtc.PercentFrameLayout
android:id="@+id/remote_video_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.webrtc.SurfaceViewRenderer
android:id="@+id/remote_video_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</org.webrtc.PercentFrameLayout>
<org.webrtc.PercentFrameLayout
android:id="@+id/local_video_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.webrtc.SurfaceViewRenderer
android:id="@+id/local_video_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:keepScreenOn="true" />
</org.webrtc.PercentFrameLayout>
PercentFrameLayout は、画面のパーセントを測定する ViewGroup サブクラスです。
実行時に setZOrderMediaOverlay を使用しようとしましたが、失敗しました。私はSDKが言うのを見つけました
これは、サーフェス ビューを含むウィンドウがウィンドウ マネージャーにアタッチされる前に設定する必要があることに注意してください。
実行時にSurfaceViewのzオーダーを
変更できないということですか?または、ハッキングする方法はありますか?
私の悪い英語でごめんなさい。
編集 1 SurfaceViewRenderとPercentFrameLayout
は
どちらもライブラリからのもので、SurfaceViewRenderはSurfaceViewサブクラスです。