首页 > 代码库 > Unable to start activity ComponentInfo{com.example.customview/com.example.customview.MainActivity}:

Unable to start activity ComponentInfo{com.example.customview/com.example.customview.MainActivity}:

今天在学自定义控件,看别人博客时把被人的code抄下来,运行时报错了,错误日记:

Unable to start activity ComponentInfo{com.example.customview/com.example.customview.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.example.customview.CustomTitleView


这个错误很容易看懂,这是由于在layout的xml文件中,写自定义的路径出问题了,因为自定义的View在xml声明是包名+类名

在此记录下,学习贵在坚持和积累

Unable to start activity ComponentInfo{com.example.customview/com.example.customview.MainActivity}: