Listview滚动崩溃 - 参数必须是此视图的后代

时间:2015-05-19 14:42:01

标签: android listview android-listview

当我滚动列表视图时,我有一个带有一个图像的简单列表视图,它崩溃时出现以下错误:

java.lang.IllegalArgumentException: parameter must be a descendant of this view
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:4884)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:4821)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup$ViewLocationHolder.init(ViewGroup.java:7239)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup$ViewLocationHolder.obtain(ViewGroup.java:7173)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup$ChildListForAccessibility.init(ViewGroup.java:7108)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup$ChildListForAccessibility.obtain(ViewGroup.java:7076)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup.addChildrenForAccessibility(ViewGroup.java:1884)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.ViewGroup.onInitializeAccessibilityNodeInfoInternal(ViewGroup.java:2766)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.View.onInitializeAccessibilityNodeInfo(View.java:5532)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.widget.AdapterView.onInitializeAccessibilityNodeInfo(AdapterView.java:941)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.widget.AbsListView.onInitializeAccessibilityNodeInfo(AbsListView.java:1493)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.widget.ListView.onInitializeAccessibilityNodeInfo(ListView.java:3882)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.View.createAccessibilityNodeInfoInternal(View.java:5493)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.View.createAccessibilityNodeInfo(View.java:5480)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchSiblingsOfRealNode(AccessibilityInteractionController.java:1028)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:885)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:155)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.AccessibilityInteractionController.access$400(AccessibilityInteractionController.java:53)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1236)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.os.Handler.dispatchMessage(Handler.java:102)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.os.Looper.loop(Looper.java:135)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at android.app.ActivityThread.main(ActivityThread.java:5312)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at java.lang.reflect.Method.invoke(Native Method)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at java.lang.reflect.Method.invoke(Method.java:372)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
05-19 18:57:12.839: E/AndroidRuntime(27931):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)

我已经查看了与此问题相关的几个主题,但没有帮助我。

有人能告诉我它试图告诉我的确切内容吗?

编辑1

列表视图

<ListView
        android:id="@+id/listview_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFFFF"
        android:cacheColorHint="#00000000"
        android:clipToPadding="false"
        android:divider="@null"
        android:dividerHeight="16dp"
        android:fadingEdge="none"
        android:listSelector="@drawable/list_selector"/>

图片浏览:

<ImageView
            android:id="@+id/image"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:contentDescription="@string/content_description"
            android:scaleType="fitXY"
            android:src="@drawable/img" />

0 个答案:

没有答案