1. 程式人生 > >_061_Android_在佈局中新增或移除元素

_061_Android_在佈局中新增或移除元素

 http://www.android-doc.com/reference/android/view/ViewGroup.html

void addView(View child, int index, ViewGroup.LayoutParams params)

Adds a child view with the specified layout parameters.

void addView(View child, ViewGroup.LayoutParams params)

Adds a child view with the specified layout parameters.

void addView(View child, int index)

Adds a child view.

void addView(View child)

Adds a child view.

void addView(View child, int width, int height)

Adds a child view with this ViewGroup's default layout parameters and the specified width and height.

 

void removeAllViews()

Call this method to remove all child views from the ViewGroup.

void removeAllViewsInLayout()

Called by a ViewGroup subclass to remove child views from itself, when it must first know its size on screen before it can calculate how many child views it will render.

void removeView(View view)

Note: do not invoke this method from draw(android.graphics.Canvas)onDraw(android.graphics.Canvas)dispatchDraw(android.graphics.Canvas) or any related method.

void removeViewAt(int index)

Removes the view at the specified position in the group.

void removeViewInLayout(View view)

Removes a view during layout.

void removeViews(int start, int count)

Removes the specified range of views from the group.

void removeViewsInLayout(int start, int count)

Removes a range of views during layout.