最近一直在忙别的项目,RecyclerView出来后,大致看了一下,并没有在实际项目中使用,今天有空写个小程序,正好用了下,遇到了如下的问题。
因为一直觉得RecyclerView用起来很简单,我就引入了包后,直接写了个控件:
<android.support.v7.widget.RecyclerView
android:id="@+id/mountain_list"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" />
然后,在activity中啥都没干,先编译一下吧。
结果编译通过,运行时遇到这个错误:
java.lang.NullPointerException: Attempt to invoke virtual method ‘boolea