OK I've gone through many similar questions here on SO and around the web, to no avail. I'm just trying to overlay a transparent view on top of a SurfaceView.. and eventually draw a rectangle on it, such that it appears to overlay the camera preview.
I cannot get the custom view to be transparent, it blocks-out the underlying camera preview. Any suggestions?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<FrameLayout
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="400dip">
<SurfaceView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/drawSurface" />
<com.bobby.facecapture.FaceOverlayView
android:id="@+id/drawOverlay"
android:background="@android:color/transparent"
android:layout_width="200dip"
android:layout_height="200dip"
/>
</FrameLayout>
</RelativeLayout>
The 200x200 is just temporary, to prove that it is indeed overlaying the other view.
The FaceOverlayView is just a custom view - deriving directly from View, without overriding anything (for now).
I get a black rectangle on top of the camera preview
Well, this resource file is the Barcode Scanner capture layout, which has a "viewfinder" layered over top of a camera preview. They use their own @color/transparent
resource, defined as <color name="transparent">#00000000</color>
. Perhaps poke around with their code and try to figure out where you and they differ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With