安卓:SurfaceView [英] Android: SurfaceView

查看:201
本文介绍了安卓:SurfaceView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我SurfaceView与 setZOrderOnTop(真)是需要在绘制过程中的透明SurfaceView的背景。这标志。

I have SurfaceView with setZOrderOnTop(true) .This flag is needed for the transparent SurfaceView's background during the drawing process.

我怎么能在它的面前显示任何视图?

How can I display any View in front of it?

推荐答案

在我的经验,仍然工作。
但是,如果你使用的RelativeLayout,这将是丑陋的。

In my experience, that still work. But if you use a RelativeLayout, it will be ugly.

<FrameLayout 
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.applicationtest.MainActivity" >
    <SurfaceView
        android:id="@+id/surfaceView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="@string/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>
    <LinearLayout
        android:layout_marginTop="50sp"
        android:orientation="vertical"
        android:background="#44444444"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <TextView
            android:text="ttttttttttttttttttttt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView
            android:text="ttttttttttttttttttttt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView
            android:text="ttttttttttttttttttttt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

</FrameLayout>

该WallPaperService是usung SurfaceView。
因此,没有理由,没有观点不能上SurfaceView顶部...(我猜?)

The WallPaperService are usung SurfaceView. So there is no reason that no view can't be on the top of SurfaceView...(I guess??)

这篇关于安卓:SurfaceView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆