自己手写了一个view发现闪退,但是抄别人代码里的却没问题,仔细看了十几分钟,一模一样的,但是自己写的就是会报错。
后来发现,view的首字母是大写的,而我写成了小写的(as还会代码提醒),结果闪退。
正确的:
<View
android:layout_width="match_parent"
android:layout_height="10px"
android:background="#c4c4c4" />
错误的:
<view
android:layout_width="match_parent"
android:layout_height="10px"
android:background="#c4c4c4" />