开发者

Can we use more than one SurfaceView in same Activity in android?

开发者 https://www.devze.com 2023-04-05 13:37 出处:网络
I am new in Android. I want to know Can we use more than one SurfaceViewin same Activity in android? If anybody knows then please tell me how?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号