.java not using the 2- or 3-argument View constructors; XML attributes will not work

后端 未结 4 716
不知归路
不知归路 2020-12-09 04:10

i\'m newbie i have problem creating game

execute process

activity_main.xml -> MainActivity.java -> GameLoop.java -> action.xml (error) -> CustomView.java

4条回答
  •  余生分开走
    2020-12-09 04:49

    You need to implement these constructors also:

    //Constructor that is called when inflating a view from XML.
    View(Context context, AttributeSet attrs)
    
    //Perform inflation from XML and apply a class-specific base style.
    View(Context context, AttributeSet attrs, int defStyle)
    

提交回复
热议问题