在Android Kitkat的relativelayout中创建两个SurfaceView时出现问题

时间:2014-02-26 13:57:31

标签: android android-layout surfaceview

当我尝试在一个相对布局中创建两个表面视图时,一个用于本地预览框架而另一个用于远程视图,我无法看到我的本地预览框架。远程视图使用完整屏幕。它适用于软糖和以下版本,但不适用于kitkat。(我正在开发基于IP的VideoCall应用程序) 这是我正在使用的代码片段:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/root_layout"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:background="#FFFFFF">
   <SurfaceView
     android:id="@+id/remote_surface"
     android:layout_height="fill_parent"
     android:layout_width="fill_parent"
     android:layout_alignParentTop="true"
     android:layout_alignParentRight="true"
     android:background="@drawable/layout_border"
   /> 
   <SurfaceView
    android:id="@+id/local_surface"
    android:layout_height="180px"
    android:layout_width="180px"
    android:layout_marginBottom="-4dip"
    android:layout_alignParentLeft="true"
    android:layout_above="@+id/swap_camera"
    android:background="@drawable/layout_border" 
  /> 
</Relativelayout>

1 个答案:

答案 0 :(得分:1)

您已将remote_surface的宽度设置为fill_parent,因此它基本上涵盖了local_surface视图。放行android:layout_above="@id/local_surface"。这应该有用。