移除相机视图中的背景叠加



我想做的是在surfaceview中创建一个相机预览,并在其顶部添加按钮。

我得到了一个相机预览,但不幸的是Linearlayout有一个丑陋的白色背景。

如何做到透明?

我甚至尝试了#00ffffff,但没有工作

<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
    <SurfaceView android:id="@+id/surfaceView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></SurfaceView>
    <LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content">
        <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
        <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    </LinearLayout>
</FrameLayout>

对于按钮,您需要添加以下属性:

android:background="@null"

最新更新