public void addView (View child) Because: API Level 1
Adds a child view. If the layout options are not already set on the child, the default settings for this ViewGroup are set on the child. options child view item to add See Also
generateDefaultLayoutParams()
Without additional parameters, addView(View) uses the default parameters (mainly WRAP_CONTENT ). If you look at the source code ,
protected LayoutParams [More ...] generateDefaultLayoutParams() { if (mOrientation == HORIZONTAL) { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } else if (mOrientation == VERTICAL) { return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); } return null; }
source share