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 <hack...@android.com> 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 <shri.bo...@gmail.com> 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 <shri.bo...@gmail.com> 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 android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en