has two possible causes
1. The internal view does not use its parent's layoutparams
when inheriting Baseadapter, when returning to view with GetView, the code controls the layout, Need to use the View.setlayoutparams, but the error, the report is a type conversion errors, after research, found that the viewgroup.layoutparams can not be used here and must use the corresponding parent view of the Layoutparams type. For example, if a view is contained by LinearLayout, the view's setlayoutparams parameter type must be Linearlayout.layoutparams. The reason for this is that linearlayout (or other layouts that inherit from ViewGroup, such as Relativelayout), LinearLayout get the layoutparams of the child view when the layout is recursive. and cast into Linearlayout.layoutparams.
2. Outermost, cannot setlayoutparams
because it has no parent. The API explains: These supply parameters to the parent of this view specifying how it should is arranged. Indicates that the parameters set here are provided to the parent.
public void Setlayoutparams (viewgroup.layoutparams params)
Since:api Level 1
Set the layout parameters Associ Ated with this view. These supply parameters to the parent of this view specifying how it should is arranged. There is many subclasses of viewgroup.layoutparams, and these correspond to the different subclasses of ViewGroup that AR E responsible for arranging their children.
About Setlayoutparams Error