Unable to start activity ComponentInfo……加载含有自定义View类的xml文件出错
2015-12-19 15:52
316 查看
自定义了ShowWindow类,继承自View类,加载含有自定义View类的xml文件出错
最后看api发现构建custom view步骤如下:
Subclass a View
Define Custom Attributes
Apply Custom Attributes to a View
Add Properties and Events
Design For Accessibility
其中第第一条说明如下
All of the view classes defined in the Android framework extend
Your custom view can also extend
or you can save time by extending one of the existing view subclasses, such as
To allow the Android Developer Tools to interact with your
view, at a minimum you must provide a constructor that takes a
an
This constructor allows the layout editor to create and edit an instance of your view.
自定义的view类至少要有含有偶context和attributeset的构造函数
最后看api发现构建custom view步骤如下:
Subclass a View
Define Custom Attributes
Apply Custom Attributes to a View
Add Properties and Events
Design For Accessibility
其中第第一条说明如下
All of the view classes defined in the Android framework extend
View.
Your custom view can also extend
Viewdirectly,
or you can save time by extending one of the existing view subclasses, such as
Button.
To allow the Android Developer Tools to interact with your
view, at a minimum you must provide a constructor that takes a
Contextand
an
AttributeSetobject as parameters.
This constructor allows the layout editor to create and edit an instance of your view.
自定义的view类至少要有含有偶context和attributeset的构造函数
相关文章推荐
- POJ1671--Painer'sProblem
- Ext.js5属性表格(更新数据)(handler和listener的区别)(蓝色的时候是蓝色的combo)(source)(19)
- iOS---SDWebImage的使用
- iOS 优秀学习资源整理 --这两个资源够你看的了
- Activity触摸事件的分发机制
- KVO的使用实例
- Subview自适应Superview的Frame AutosizingMask(转)
- rk32_4_4没有LVDS问题
- [LeetCode] Minimum Size Subarray Sum 解题思路
- Ajax注册用户时实现表单验证
- php小结---当解析变量的值分别为 null, "" ,0 ,"0" ,1 时的不同情况
- 初识ACM——2015国庆培训
- 线刷和卡刷的区别以及步骤
- IOS_归档与解档
- 大坑!动态规划!SHU 1149 能量项链(区间DP)
- hdoj 1506&&1505(City Game) dp
- Box2d 物体互相碰撞的条件
- 黑马程序员——第十六篇:反射
- xcode7真机调试问题
- 我眼中的互联网运营感观——如何进行活动组织?