ListView里的放RelativeLayout 报错

转载请声明 http://www.niuzhi.cc/



报了这个错,找了很久才找到原因
03-09 10:01:16.342: E/AndroidRuntime(9850): java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.ListView.setupChild(ListView.java:1827)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.ListView.makeAndAddView(ListView.java:1796)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.ListView.fillDown(ListView.java:670)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.ListView.fillFromTop(ListView.java:727)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.ListView.layoutChildren(ListView.java:1646)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.AbsListView.onLayout(AbsListView.java:1260)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.view.View.layout(View.java:7277)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.view.View.layout(View.java:7277)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.view.View.layout(View.java:7277)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.view.View.layout(View.java:7277)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.view.ViewRoot.performTraversals(ViewRoot.java:1203)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1957)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.os.Looper.loop(Looper.java:143)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at android.app.ActivityThread.main(ActivityThread.java:4310)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at java.lang.reflect.Method.invokeNative(Native Method)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at java.lang.reflect.Method.invoke(Method.java:507)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-09 10:01:16.342: E/AndroidRuntime(9850): 	at dalvik.system.NativeStart.main(Native Method)
原因是我在ListView里的放RelativeLayout,并且把RelativeLayout的LayoutParam设为 RelativeLayout.LayoutParam所以才会报错,改为:ListView.
LayoutParam就不会出问题了





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

C_Wayne

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值