E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nj.wellsign, PID: 1611
java.lang.ArrayIndexOutOfBoundsException: length=73; index=-1
at java.util.ArrayList.get(ArrayList.java:413)
at com.othershe.groupindexlib.decoration.GroupHeaderItemDecoration.onDrawOver(GroupHeaderItemDecoration.java:100)
at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:3991)
at android.view.View.updateDisplayListIfDirty(View.java:16081)
at android.view.View.draw(View.java:16865)
好像是在这里没有对 position 为-1 时候进行判断,因为
int position = ((LinearLayoutManager)((LinearLayoutManager)parent.getLayoutManager())).findFirstVisibleItemPosition();
这里如果没有可见的item的话 会返回-1 ,
String tag = (String)this.tags.get(position);这里对-1取值,所以出了问题。
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.nj.wellsign, PID: 1611 java.lang.ArrayIndexOutOfBoundsException: length=73; index=-1 at java.util.ArrayList.get(ArrayList.java:413) at com.othershe.groupindexlib.decoration.GroupHeaderItemDecoration.onDrawOver(GroupHeaderItemDecoration.java:100) at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:3991) at android.view.View.updateDisplayListIfDirty(View.java:16081) at android.view.View.draw(View.java:16865)
好像是在这里没有对 position 为-1 时候进行判断,因为 int position = ((LinearLayoutManager)((LinearLayoutManager)parent.getLayoutManager())).findFirstVisibleItemPosition(); 这里如果没有可见的item的话 会返回-1 , String tag = (String)this.tags.get(position);这里对-1取值,所以出了问题。
在GroupHeaderItemDecoration 这个类的 84 和85 行,希望大神能看一下。谢谢了