I have a SurfaceView named MyBringBackSurface, and the constructor is:
public MyBringBackSurface(Context context) {
// TODO Auto-generated constructor stub
super(context);
setBackgroundResource(R.drawable.background);
}
The background shows up but how to make it transparent so it show other Bitmaps in front of it?
use Color.TRANSPARENT as a background color for your surfaceview.
If you want to show bitmap over the surface view you can try something like below xml
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center">
<SurfaceView
android:id="@+id/cameraSurface"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/IV_MASK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mask"
android:background="@android:color/transparent"
/>
</RelativeLayout>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.