Java.lang.classcastexception:android.widget.framelayout$layoutparams cannot is cast to ANDROID.WIDGtime 2013-09-23 22:36:41 The arrogant Colonel's column of the original http://blog.csdn.net/lilu_leo/article/details/11952717
Sometimes you need to set layoutparams in the code, you set the Layoutparams for a framelayout, encounter title problems,
Java.lang.ClassCastException:android.widget.FrameLayout$LayoutParams cannot is cast to Android.widget.LinearLayout$LayoutParams
Framelayout's parent control is a LinearLayout control, and the problem is that when LinearLayout allocates space for a child control, The layoutparams of the framelayout must be linearlayout.layoutparams, not framelayout.layoutparams.
Simply give a chestnut to illustrate: the outermost has relativelayout a, which has two linearlayout B, C, and B has a framelayout D. If you want to set B's layoutparams,b in the code, Layoutparams is relativelayout.layoutparams.
New Relativelayout.layoutparams (Layoutparams.match_parent, layoutparams.match_parent); b.setlayoutparams (params);
and d to set it, you need:
0); 8; D.setlayoutparams (params);
This problem can be solved. Or some of their basic knowledge is not strong, write this.
Android.widget.framelayout$layoutparams cannot is cast to Android.widget.linearlayout$layoutparams