Android笔记:自定义控件-is not using the 2- or 3-argument Vieconstructors; XML attributes will not work
来源:互联网 发布:提字器软件 编辑:程序博客网 时间:2024/06/12 01:51
很久没有使用过自定义View了,最近在使用的过程中无意间犯了一个小错误,记录下来,在使用自定义控件时出现了以下的错误提示:
这段话简单翻译一下呢就是自定义View 没有使用两个或三个的构造函数,xml文件不能正常工作
解决方法就是添加两个参数的构造参数或者是三个构造参数的构造方法。
贴出来代码简单看下:
public class RectView extends View { public RectView(Context context) { super(context); } public RectView(Context context, AttributeSet attrs) { super(context, attrs); } public RectView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public RectView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); }}
在给自定义View添加构造函数的时候呢,要注意下一定要添加两个以上。
0 0
- Android笔记:自定义控件-is not using the 2- or 3-argument Vieconstructors; XML attributes will not work
- Android 自定义控件build时提示Custom view * is not using the 2- or 3-argument View constructors; XML attribut
- 自定义安卓控件错误 Custom view MySwitchBtn is not using the 2- or 3-argument View constructors; XML attribute
- 自定义控件出现Custom view * is not using the 2- or 3-argument View constructors
- 自定义控件:not using the 2- or 3-argument View constructors
- Android Bug:Custom view * is not using the 2- or 3-argument
- android错误提醒之:Custom view * is not using the 2- or&nb(自定义控件)
- not using the 2- or 3-argument View constructors
- Custome View is not using the 2-or-3-argumentView constructors
- JSP scriptlets will not work properly if using OJSP 解决
- WARNING IPv4 forwarding is disabled. Networking will not work
- WARNING IPv4 forwarding is disabled. Networking will not work
- widnows:The signal HUP is in use by the JVM and will not work correctly on this platform
- RVM is not a function, selecting rubies with 'rvm use ...' will not work.
- Why the “MAVEN2_CLASSPATH_CONTAINER will not be exported or published”
- "Missing or invalid signature. The bundle '' at bundle path '' is not signed using an Apple submiss
- ADF运行jsp的时候出现 JSP scriptlets will not work properly if using OJSP
- 1414 - OUT or INOUT argument 3 for routine nenghao.xxx is not a variable or NEW pseudo-variable in B
- 洛谷 P1757 通天之分组背包
- Android四大组件之三:BroadcastReceiver总结
- 大数据概述
- 监听器(Listener)学习
- NKOI 3500 独立集
- Android笔记:自定义控件-is not using the 2- or 3-argument Vieconstructors; XML attributes will not work
- canvas画布变换画六芒星
- 区域控制的使用
- 数据库作业之SQL语句实现简单查询功能
- iis7.0 安装后无法显示html页面但是其他的aspx等界面可以显示
- 162滑动(10)167(11)171(12)182(14)187(15)
- canvas画旋转椭圆
- .NET开发环境搭建
- Java之类实例化的顺序