首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓: SurfaceView

安卓: SurfaceView
EN

Stack Overflow用户
提问于 2012-02-07 18:36:53
回答 2查看 1K关注 0票数 0

我有一个带有setZOrderOnTop(true)的SurfaceView,在绘制过程中透明的SurfaceView的背景需要.This标志。

如何在其前面显示任何视图?

EN

回答 2

Stack Overflow用户

发布于 2012-02-07 20:02:41

SurfaceViews不是为与其他视图组合而设计的。正如setZOrderOnTop文档中所述,一旦设置了此模式,SurfaceView上的任何其他窗口内容都将不可见。

如果你想做合成,你必须自己做,在屏幕外,然后将结果绘制到SurfaceView中。

票数 0
EN

Stack Overflow用户

发布于 2016-01-21 01:52:49

根据我的经验,这仍然有效。但是如果你使用RelativeLayout,它会很难看。

代码语言:javascript
复制
<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使用SurfaceView。因此,没有理由没有视图不能位于SurfaceView的顶部...(我猜??)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9174712

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档