Android 自定义控件build时提示Custom view * is not using the 2- or 3-argument View constructors; XML attribut
2013-09-29 11:29
453 查看
如果你的控件继承自view那么需要写上三个构造函数,其它的可以查看源码,只要把全部的继承函数都写上去就可以了。
View的三个继承函数是:
说明:这里的init是我的控件要执行的一个默认方法,其它的控件同理,只要写上全部的构造函数就不会把这样的错误了。
(完)
View的三个继承函数是:
public WiperSwitch(Context context) { super(context); init(); } public WiperSwitch(Context context, AttributeSet attrs){ super(context,attrs); init(); } public WiperSwitch(Context context,AttributeSet attrs,int defStyle){ super(context,attrs,defStyle); init(); }
说明:这里的init是我的控件要执行的一个默认方法,其它的控件同理,只要写上全部的构造函数就不会把这样的错误了。
(完)
相关文章推荐
- Custom view * is not using the 2- or 3-argument View constructors; XML attributes will not work
- 自定义控件出现Custom view * is not using the 2- or 3-argument View constructors
- Android笔记:自定义控件-is not using the 2- or 3-argument Vieconstructors; XML attributes will not work
- Android Bug:Custom view * is not using the 2- or 3-argument
- android错误提醒之:Custom view * is not using the 2- or&nb(自定义控件)
- 自定义安卓控件错误 Custom view MySwitchBtn is not using the 2- or 3-argument View constructors; XML attribute
- Custome View is not using the 2-or-3-argumentView constructors
- 自定义控件:not using the 2- or 3-argument View constructors
- not using the 2- or 3-argument View constructors
- The original file 'AndroidManifest.xml' has been deleted or is not accessible
- Eclipse错误提示:The project was not built since its build path is incomplete. Cannot find the class file
- web 项目中打开 hibernate.cfg.xml 文件时 提示:The project is not a myEclipse hibernate project
- 安装Visual Studio 2010时提示"The location specified for the help content store is invalid or you do not have access to it".
- Error starting the test run: Build directory of the test run is not specified or does not exist
- eclispe android导入工程出现The project was not built since its build path is incomplete. Cannot find...
- android之“java.lang.IllegalArgumentException: Window type can not be changed after the window is add”
- java.lang.illegalargumentexception view android.widget.listview is not a sliding drawer
- build case study 提示 the java db location is not set correctly
- xml无法显示(Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again la
- Android中使用setBackgroundDrawable错误提示:The method setBackgroundDrawable(Drawable) from the type View is