我只想做一个视频呼叫布局,面对这个问题,我想为swithc相机、静音、终端呼叫和一些信息添加一些imageView和surfaceView按钮,这是我的xml。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<org.webrtc.SurfaceViewRenderer
android:id="@+id/preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/rind"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- here my ImageView and button -->
</LinearLayout>
</RelativeLayout>
SurfaceViewRenderer its扩展surfaceView
现在,当我运行这个程序时,我无法在surfaceView中看到我的相机,我为我的SurfaceViewRenderer添加了红色的背景,在没有相机显示的情况下,我只是搜索并找到了mySurfaceView.setZOrderOnTop(true);
,我添加了它,现在它显示了相机的显示,但是我看不到我的视图(静音,结束呼叫.)
我也试着
mySurfaceView.setZOrderMediaOverlay(true);
mySurfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
无效
我只想做这样的布局
在我使用surfaceView
之前,我尝试了glsurfaceview
,但是它是一样的,而且我读到了我无法在glsurfaceview中添加视图(添加窗口视图)
发布于 2017-11-10 06:54:27
试一试,希望这能帮到你:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:clipChildren="false"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--local view-->
<com.example.gwl.apprtc.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"/>
<!--remote View -->
</com.example.gwl.apprtc.PercentFrameLayout>
<com.example.gwl.apprtc.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"/>
</com.example.gwl.apprtc.PercentFrameLayout>
<!---->
</FrameLayout>
<FrameLayout
android:id="@+id/buttons_call_container"
android:orientation="horizontal"
android:layout_marginBottom="@dimen/marginBottom_32dp"
android:layout_gravity="bottom|center"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:id="@+id/button_call_disconnect"
android:background="@drawable/disconnect"
android:contentDescription="@string/disconnect_call"
android:layout_width="@dimen/layoutWidth_48dp"
android:layout_height="@dimen/layoutHeight_48dp"/>
<ImageButton
android:id="@+id/button_call_toggle_mic"
android:background="@android:drawable/ic_btn_speak_now"
android:contentDescription="@string/toggle_mic"
android:layout_marginRight="@dimen/marginRight_10dp"
android:layout_width="@dimen/layoutWidth_48dp"
android:layout_height="@dimen/layoutHeight_48dp"/>
<ImageButton
android:id="@+id/button_call_switch_camera"
android:background="@android:drawable/ic_menu_camera"
android:layout_marginEnd="8dp"
android:layout_width="48dp"
android:layout_height="48dp"/>
</LinearLayout>
</FrameLayout>
</FrameLayout>
https://stackoverflow.com/questions/45519747
复制相似问题