android 重写View遇见错误:Error inflating class

这只是缺少了一种构造方法:

public HandleView(Context context, AttributeSet attrs) { 
         this(context, attrs, 0); 
     } 

在重写的View中加上这个构造函数即可。

发布了28 篇原创文章 · 获赞 14 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_28738419/article/details/77936188
今日推荐