Android glSurfaceView with overlay using XML/Java

前端 未结 2 1744
孤街浪徒
孤街浪徒 2021-01-12 20:32

I started an Android OpenGL application and I have the following classes:

class A extends Activity
class B extends GlSurfaceView implements Renderer
<         


        
2条回答
  •  长情又很酷
    2021-01-12 21:14

    Okay, so the proper way of doing this is to have a constructor in the B class which takes in:

    B(Context context, AttributeSet attrs)
    {
      super(context, attrs);
    }
    

    And in the XML layout, use this:

    
    

    The thing that was missing in my code was the constructor signature.

提交回复
热议问题