致命异常:java.lang.IndexOutOfBoundsException:索引5无效,大小为1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayLis enter code here
t.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
在android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:230)
在android.widget.AbsListView.obtainView(AbsListView.java:2351)
在android.widget.ListView.makeAndAddView(ListView.java:1816)
在android.widget.ListView.fillDown(ListView.java:697)
在android.widget.ListView.fillGap(ListView.java:661)
在android.widget.AbsListView.trackMotionScroll(AbsListView.java:5520)
在android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3403)
在android.widget.AbsListView.onTouchMove(AbsListView.java:3750)
在android.widget.AbsListView.onTouchEvent(AbsListView.java:3591)
在android.view.View.dispatchTouchEvent(View.java:7823)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2344)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2068)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2083)
在com.android.internal.policy.impl.PhoneWindow $ DecorView.superDispatchTouchEvent(PhoneWindow.java:2216)
在com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1563)
在android.app.Activity.dispatchTouchEvent(Activity.java:2552)
在android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
在android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
在com.android.internal.policy.impl.PhoneWindow $ DecorView.dispatchTouchEvent(PhoneWindow.java:2164)
在android.view.View.dispatchPointerEvent(View.java:8003)
在android.view.ViewRootImpl $ ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4215)
在android.view.ViewRootImpl $ ViewPostImeInputStage.onProcess(ViewRootImpl.java:4094)
在android.view.ViewRootImpl $ InputStage.deliver(ViewRootImpl.java:3652)
在android.view.ViewRootImpl $ InputStage.onDeliverToNext(ViewRootImpl.java:3706)
在android.view.ViewRootImpl $ InputStage.forward(ViewRootImpl.java:3675)
在android.view.ViewRootImpl $ AsyncInputStage.forward(ViewRootImpl.java:3786)
在android.view.ViewRootImpl $ InputStage.apply(ViewRootImpl.java:3683)
在android.view.ViewRootImpl $ AsyncInputStage.apply(ViewRootImpl.java:3843)
在android.view.ViewRootImpl $ InputStage.deliver(ViewRootImpl.java:3652)
在android.view.ViewRootImpl $ InputStage.onDeliverToNext(ViewRootImpl.java:3706)
在android.view.ViewRootImpl $ InputStage.forward(ViewRootImpl.java:3675)
在android.view.ViewRootImpl $ InputStage.apply(ViewRootImpl.java:3683)
在android.view.ViewRootImpl $ InputStage.deliver(ViewRootImpl.java:3652)
在android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5928)
在android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5877)
在android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5848)
在android.view.ViewRootImpl $ WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6008)
在android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
在android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
在android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
在android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5981)
在android.view.ViewRootImpl $ ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6027)
在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:761)
在android.view.Choreographer.doCallbacks(Choreographer.java:574)
在android.view.Choreographer.doFrame(Choreographer.java:542)
在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:747)
在android.os.Handler.handleCallback(Handler.java:733)
在android.os.Handler.dispatchMessage(Handler.java:95)
在android.os.Looper.loop(Looper.java:136)
在android.app.ActivityThread.main(ActivityThread.java:5590)
at java.lang.reflect.Method.invokeNative(Method.java)
在java.lang.reflect.Method.invoke(Method.java:515)
在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1268)
在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
在dalvik.system.NativeStart.main(NativeStart.java)
答案 0 :(得分:0)
列表视图中的listitem通货膨胀就是这样。您正在尝试访问数组列表中仅有一个大小的第5个元素。而不是静态地尝试获取值,而是通过使用位置字段动态使用listview