[英]How to make background of SurfaceView Transparent?
我有一個名為MyBringBackSurface的SurfaceView,其構造函數為:
public MyBringBackSurface(Context context) {
// TODO Auto-generated constructor stub
super(context);
setBackgroundResource(R.drawable.background);
}
會顯示背景,但是如何使其透明,以便在其前面顯示其他位圖?
使用Color.TRANSPARENT作為您的Surfaceview的背景色。
如果要在曲面視圖上顯示位圖,則可以嘗試以下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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.