2012-02-07 5 views
0

나는 SurfaceView에 setZOrderOnTop(true)을 가지고 있습니다.이 플래그는 드로잉 과정에서 투명한 SurfaceView의 배경에 필요합니다.Android : SurfaceView

어떻게 앞에 모든보기를 표시 할 수 있습니까?

답변

0

SurfaceViews는 다른보기와 합성하도록 설계되지 않았습니다. setZOrderOnTop의 문서에서 설명했듯이이 모드를 설정하면 다른 창 내용이 SurfaceView 위에 표시되지 않습니다.

합성을 원한다면, 오프 스크린으로 직접해야하고 결과를 SurfaceView에 그려야합니다.

+0

어떻게 SurfaceView에 결과를 그릴 수 있습니까? – mrhard4

0

내 경험에 따르면 여전히 작동합니다. 그러나 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의 꼭대기에보기가 없다는 이유가 없습니다 ... (제가 추측 하시죠?)

관련 문제