Java语法问题~~Implicit super constructor LinearLayout() is undefined.
Android写程序遇到一个问题:当程序这样写:packagecom.example.diy_view;importandroid.content.Context;imp...
Android写程序遇到一个问题:
当程序这样写:
package com.example.diy_view;
import android.content.Context;
import android.widget.LinearLayout;
public class View_try1 extends LinearLayout {
public View_try1(Context context) {
// TODO Auto-generated constructor stub
}
}
会报错:
Implicit super constructor LinearLayout() is undefined. Must explicitly invoke another constructor
改成:
package com.example.diy_view;
import android.content.Context;
import android.widget.LinearLayout;
public class View_try1 extends LinearLayout {
public View_try1(Context context) {
// TODO Auto-generated constructor stub
super(context);
}
}
就没错了
谁能解释下这是什么原因?谢谢 展开
当程序这样写:
package com.example.diy_view;
import android.content.Context;
import android.widget.LinearLayout;
public class View_try1 extends LinearLayout {
public View_try1(Context context) {
// TODO Auto-generated constructor stub
}
}
会报错:
Implicit super constructor LinearLayout() is undefined. Must explicitly invoke another constructor
改成:
package com.example.diy_view;
import android.content.Context;
import android.widget.LinearLayout;
public class View_try1 extends LinearLayout {
public View_try1(Context context) {
// TODO Auto-generated constructor stub
super(context);
}
}
就没错了
谁能解释下这是什么原因?谢谢 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询