Android xml 报错Caused by: android.view.InflateException:

今天再次碰到了那个让人哭笑不得的Bug,好好的写的java

ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_his_stock, container, false);

莫名报错:android

Caused by: android.view.InflateException: Binary XML file line #70: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

找了很久没有发现有用空对象进行字符串比较,后来想着是Xml inflate报错,就去布局文件看了下,看到<view> 的时候瞬间惊醒,应该是大写的<View>:布局

<View
                        android:layout_width="0.7dp"
                        android:layout_height="match_parent"
                        android:layout_marginBottom="@dimen/elevation_10dp"
                        android:layout_marginTop="@dimen/elevation_10dp"
                        android:alpha="0.4"
                        android:background="@color/bg_litter_blue" />

写在这里给本身提个醒!code