Can we use more than one SurfaceView in same Activity in android?
I am new in Android. I want to know Can we use more than one SurfaceView in same Activity in android?
If anybody knows then please tell me how?
I am stuck on this issues.
Thanks.开发者_C百科
I have not did it but try this..May it possible
For example
LinearLayout ll1=new LinearLayout(this);
LinearLayout ll2=new LinearLayout(this);
LinearLayout ll3=new LinearLayout(this);
ll1.addView(surfaceview1ObjectFirst);
ll2.addView(surfaceview1ObjectSecond);
ll3.addView(surfaceview1ObjectThird);
Updated
You can add more than one surfaceView inside one activity. Add them just like you add other view inside ViewGroup
You can't have more than one SurfaceView
in a Window.
A SurfaceView
punches a "hole" in the current window (seethrough) and places its own window below the current window where it can draw itself.
You can't have several "holes" in the same window.
If you need to use several SurfaceViews
, create a Dialog
for each one and place them inside the Dialog
.
精彩评论