今天再次碰到了那个让人啼笑皆非的Bug,好好的写的
ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_his_stock, container, false);
莫名报错:
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" />
写在这里给自己提个醒!