私はsetZOrderOnTop(true)
のSurfaceViewを持っています。このフラグは、描画プロセス中の透明なSurfaceViewの背景に必要です。Android:SurfaceView
どのように表示することができますか?
私はsetZOrderOnTop(true)
のSurfaceViewを持っています。このフラグは、描画プロセス中の透明なSurfaceViewの背景に必要です。Android:SurfaceView
どのように表示することができますか?
SurfaceViewsは他のビューと合成されるようには設計されていません。 setZOrderOnTopのドキュメントで説明したように、このモードを設定すると、他のウィンドウの内容はSurfaceViewの上に表示されません。
合成したい場合は、オフスクリーンで自分で行う必要があります。その結果をSurfaceViewに描画します。
私の経験では、それでも動作します。 しかし、RelativeLayoutを使用すると、醜いでしょう。
<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の上に表示することができないという理由はありません...(私は思いますか?)
どのように結果をSurfaceViewに描画できますか? – mrhard4