本文主要是介绍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的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!