Error when inflating android.support.design.widget.TextInputLayout

起因:

今天使用android design support lib,写个使用textinputlayout的小demo,在画完布局之后一直报错

Error when inflating android.support.design.widget.TextInputLayout

,一直找不到原因,最后百度得知:

I've encountered the same problem. Make sure that you're using an AppCompat theme and that you are inflating the view in an AppCompatActivity context.

原地址:点击打开链接


2016.1.9 再次掉入此坑,原因是找不到要加载的design support lib中的类,因为之前遇到过此类问题,我以为是没有继承appcompatactivity或者是主题样式没有继承theme.appcompat,但是发现这些都没有问题,一度导致不知道怎么解决,重看代码:

发现如果布局文件中如果有错误的话,也会导致这个问题的出现。检查完布局文件中没有错误了,clean一下工程进行测试。

你可能感兴趣的:(异常处理)