如何在ImageView上设置SurfaceView

时间:2013-07-26 05:46:14

标签: android android-layout opengl-es

我想在ImageView上设置SurfaceView。我使用下面的代码和布局。它在imageview上设置了表面视图,但它将surfaceview设置为所有视图的顶部。

还有其他方法可以在ImageView上设置SurfaceView。

请帮帮我。

代码:

setEGLConfigChooser(8, 8, 8, 8, 16, 0);
getHolder().setFormat(PixelFormat.TRANSLUCENT);
setZOrderOnTop(true);

布局

<FrameLayout
    android:id="@+id/topFrameLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <!-- ImageView for the product -->

    <ImageView
        android:id="@+id/photoImageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <com.amplimesh.renderer.RendererView
        android:id="@+id/renderer_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent" />

1 个答案:

答案 0 :(得分:0)

确保添加

gl.glClearColor(0.0f, 0.0f, 0.0f, 0);
在渲染器中

以确保背景透明。