为了账号安全,请及时绑定邮箱和手机立即绑定

如何使表面视图透明

如何使表面视图透明

ITMISS 2019-07-27 15:15:52
如何使表面视图透明你好,我只想让我的DrawinSurface视图透明。我试了很多次,但都没用。下面是我的xml代码,以使我的表面视图透明<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >     <FrameLayout         android:layout_width="fill_parent"         android:layout_height="fill_parent" >         <ImageView             android:id="@+id/imageView1"             android:layout_width="fill_parent"             android:layout_height="fill_parent"             android:src="@drawable/icon" >         </ImageView>         <LinearLayout             android:id="@+id/linearLayout1"             android:layout_width="fill_parent"             android:layout_height="fill_parent"             android:background="#00000000" >             <codewalla.android.drawings.DrawingSurface                 android:id="@+id/drawingSurface"                 android:layout_width="fill_parent"                 android:layout_height="fill_parent" >             </codewalla.android.drawings.DrawingSurface>         </LinearLayout>     </FrameLayout>     <LinearLayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:orientation="horizontal" >         <Button             android:id="@+id/colorRedBtn"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_weight="10"             android:onClick="onClick"             android:text="R" />         <Button             android:id="@+id/colorBlueBtn"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_weight="10"             android:onClick="onClick"             android:text="G" />       </LinearLayout></RelativeLayout>
查看完整描述

3 回答

?
红糖糍粑

TA贡献1815条经验 获得超6个赞

在构造函数中尝试如下:

SurfaceView sfvTrack = (SurfaceView)findViewById(R.id.sfvTrack);sfvTrack.setZOrderOnTop(true);   
 // necessarySurfaceHolder sfhTrackHolder = sfvTrack.getHolder();sfhTrackHolder.setFormat(PixelFormat.TRANSPARENT);


查看完整回答
反对 回复 2019-07-28
?
素胚勾勒不出你

TA贡献1827条经验 获得超9个赞

sfvTrack.setZOrderOnTop(true);

将表面视图放置在窗口的顶部,这意味着您不能在表面视图之上添加项。

如果要在表面视图的顶部添加视图,则应考虑使用:

setZOrderMediaOverlay(true);

相反。这将该表面视图放置在其他表面视图的顶部,但仍然在窗口后面,允许您在表面视图的顶部添加其他可见视图。



查看完整回答
反对 回复 2019-07-28
  • 3 回答
  • 0 关注
  • 324 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信