android - How to set the Z order of multiple SurfaceViews -
i have surfaceview
live preview of camera, glsurfaceview
draw opengl objects , last surfaceview
show gui elements. i'm trying put glsurfaceview
on camera's surfaceview
, @ same time want gui's surfaceview
above glsurfaceview
. tried setzorderontop
function, won't work more 2 surfaceview
s. there way manage z order of multiple view
s?
is there way manage z order of multiple views?
step #1: put them in container supports z-axis ordering, framelayout
or relativelayout
.
step #2: later children higher in z axis earlier children, sequence children appropriate.
for example:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/big" android:textsize="120dip" android:textstyle="bold"/> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:text="@string/small"/> </relativelayout>
the second button (with android:text="@string/small"
) appear float on top of first button.
now, surfaceviews
unusual beasts, , surprised if can them work way want. if android:minsdkversion
14 or higher, consider switching textureview
.
Comments
Post a Comment