android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams

直接导火索:getView返回的view 内容执行了

    ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    setLayoutParams(layoutParams);

推送:listView作为容器,子view不能适应ViewGroup.LayoutParams,而是需要abslistView

解决办法:删除这个设置

问题发生在4.4.x的手机上

 

android.widget.ListView.setupChild(ListView.java:1868)

2 android.widget.ListView.makeAndAddView(ListView.java:1823)

3 android.widget.ListView.fillSpecific(ListView.java:1352)

4 android.widget.ListView.layoutChildren(ListView.java:1641)

5 android.widget.AbsListView.onLayout(AbsListView.java:2177)

6 android.view.View.layout(View.java:15184)

7 android.view.ViewGroup.layout(ViewGroup.java:4901)

8 android.widget.FrameLayout.layoutChildren(FrameLayout.java:500)

9 android.widget.FrameLayout.onLayout(FrameLayout.java:435)

10 android.view.View.layout(View.java:15184)

11 android.view.ViewGroup.layout(ViewGroup.java:4901)

12 android.widget.RelativeLayout.onLayout(RelativeLayout.java:1154)

你可能感兴趣的:(android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams)