I though z-order of SurfaceViews is nothing to do(and not guaranted) with order of layout.addView(SurfaceView). but this seems to have something to do with the order of the addView(). For example,
// v2 should be on top of v1 SurfaceView v1; GLSurfaceView v2; // Case 1 : always v2 is on top of v1 v2.setZOrderMediaOverlay(true) parent.addView(v1); parent.addView(v2); // Case 2 : sometimes v2 is on top of v1 v2.setZOrderMediaOverlay(true) parent.addView(v2); parent.addView(v1); Does setZOrderMediaOverlay(true) only works if it is the last child? 2011년 9월 8일 목요일 오전 3시 29분 22초 UTC+9, Dianne Hackborn 님의 말: > > This is used by the standard launcher for its apps list, so it works > correctly. > > I regret making it public because it really violates the intended > semantics of SurfaceView. > > On Wed, Sep 7, 2011 at 9:57 AM, Shri <[email protected] <javascript:>>wrote: > >> I have subclassed SurfaceView and call #setZOrderMediaOverlay in the >> constructor. So it is getting called before the SurfaceView is >> attached to the window. But it still does not work consistently. >> >> By "it is too bad we made that API public.", do you mean that there >> are known issues with using this API? It would be good to know how >> much to rely on it so we can look at alternatives. Since it only >> misbehaves occasionally, its never clear if a change in the code has >> actually fixed the problem or not. >> >> Thanks >> Shri >> >> On Jul 27, 12:43 pm, Dianne Hackborn <[email protected]> wrote: >> > Well it is too bad we made that API public. :p >> > >> > You can use "adb shell dumpsys window" to see the windows in the window >> > manager, to see how your windows have been Z-ordered. Also be sure you >> are >> > setting this property before the SurfaceView is attached to its window, >> and >> > never changing it. >> > >> > >> > >> > On Tue, Jul 26, 2011 at 10:51 PM, Shri <[email protected]> wrote: >> > > I am occasionaly seeing this on Nexus S Gingerbread MR1 as well. Is >> > > this a bug in setZOrderMediaOverlay? >> > >> > > On Jul 13, 2:09 pm, Shri <[email protected]> wrote: >> > > > I have a small screen camera preview being shown on top of a larger >> > > > video (see layout at the end). I use >> > > > SurfaceView#setZOrderMediaOverlay(true) on the small camera preview, >> > > > and this works most of the time. However, occasionally, the camera >> > > > preview is not fully displayed. Only the part of it not blocked by >> the >> > > > larger video view is displayed, while the 5dip black border *is* >> fully >> > > > displayed on top of the large video. >> > >> > > > So it seems like SurfaceView#setZOrderMediaOverlay(true) is not >> > > > working as expected. My understanding of the API is that it >> guarantees >> > > > that the SurfaceView will be displayed on top of other SurfaceViews. >> > >> > > > I do not want to use #setZOrderOnTop as I do want to overlap the >> > > > camera preview with some icons, and using #setZOrderOnTop(true) >> would >> > > > cause the camera preview to display on top of the overlay icons. >> > >> > > > Any idea why #setZOrderMediaOverlay(true) misbehaves occasionally? I >> > > > am on Honeycomb MR1 on Motorola Xoom. >> > >> > > > Thanks, >> > > > Shri >> > >> > > > <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/ >> > > > android" >> > > > android:orientation="horizontal" >> > > > android:layout_width="match_parent" >> > > > android:layout_height="match_parent"> >> > >> > > > <SurfaceView >> > > > android:id="@+id/some_video" >> > > > android:layout_width="match_parent" >> > > > android:layout_height="match_parent" /> >> > >> > > > <!-- Camera preview border --> >> > > > <RelativeLayout >> > > > android:id="@+id/camera_preview_and_overlays" >> > > > android:layout_width="100dip" >> > > > android:layout_height="50dip" > >> > > > <!-- Camera preview. #setZOrderMediaOverlay(true) will be >> called >> > > > for this. --> >> > > > <SurfaceView >> > > > android:id="@+id/camera_preview" >> > > > android:layout_width="match_parent" >> > > > android:layout_height="match_parent"/> >> > > > <ImageView >> > > > android:id="@+id/overlay_icon" >> > > > android:layout_width="match_parent" >> > > > android:layout_height="match_parent"/> >> > >> > > > </RelativeLayout> >> > > > </RelativeLayout> >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> > > Groups "Android Developers" group. >> > > To post to this group, send email to >> > > [email protected]<javascript:> >> > > To unsubscribe from this group, send email to >> > > [email protected] <javascript:> >> > > For more options, visit this group at >> > >http://groups.google.com/group/android-developers?hl=en >> > >> > -- >> > Dianne Hackborn >> > Android framework engineer >> > [email protected] >> > >> > Note: please don't send private questions to me, as I don't have time to >> > provide private support, and so won't reply to such e-mails. All such >> > questions should be posted on public forums, where I and others can see >> and >> > answer them. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to >> [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > > > -- > Dianne Hackborn > Android framework engineer > [email protected] <javascript:> > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. > > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

