@@ -3806,6 +3806,13 @@ public void removeAllViewsInLayout() {
38063806 /**
38073807 * Finishes the removal of a detached view. This method will dispatch the detached from
38083808 * window event and notify the hierarchy change listener.
3809+ * <p>
3810+ * This method is intended to be lightweight and makes no assumptions about whether the
3811+ * parent or child should be redrawn. Proper use of this method will include also making
3812+ * any appropriate {@link #requestLayout()} or {@link #invalidate()} calls.
3813+ * For example, callers can {@link #post(Runnable) post} a {@link Runnable}
3814+ * which performs a {@link #requestLayout()} on the next frame, after all detach/remove
3815+ * calls are finished, causing layout to be run prior to redrawing the view hierarchy.
38093816 *
38103817 * @param child the child to be definitely removed from the view hierarchy
38113818 * @param animate if true and the view has an animation, the view is placed in the
@@ -3846,10 +3853,17 @@ protected void removeDetachedView(View child, boolean animate) {
38463853
38473854 /**
38483855 * Attaches a view to this view group. Attaching a view assigns this group as the parent,
3849- * sets the layout parameters and puts the view in the list of children so it can be retrieved
3850- * by calling {@link #getChildAt(int)}.
3851- *
3852- * This method should be called only for view which were detached from their parent.
3856+ * sets the layout parameters and puts the view in the list of children so that
3857+ * it can be retrieved by calling {@link #getChildAt(int)}.
3858+ * <p>
3859+ * This method is intended to be lightweight and makes no assumptions about whether the
3860+ * parent or child should be redrawn. Proper use of this method will include also making
3861+ * any appropriate {@link #requestLayout()} or {@link #invalidate()} calls.
3862+ * For example, callers can {@link #post(Runnable) post} a {@link Runnable}
3863+ * which performs a {@link #requestLayout()} on the next frame, after all detach/attach
3864+ * calls are finished, causing layout to be run prior to redrawing the view hierarchy.
3865+ * <p>
3866+ * This method should be called only for views which were detached from their parent.
38533867 *
38543868 * @param child the child to attach
38553869 * @param index the index at which the child should be attached
@@ -3881,10 +3895,13 @@ protected void attachViewToParent(View child, int index, LayoutParams params) {
38813895 }
38823896
38833897 /**
3884- * Detaches a view from its parent. Detaching a view should be temporary and followed
3885- * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3886- * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached,
3887- * its parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}.
3898+ * Detaches a view from its parent. Detaching a view should be followed
3899+ * either by a call to
3900+ * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3901+ * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be
3902+ * temporary; reattachment or removal should happen within the same drawing cycle as
3903+ * detachment. When a view is detached, its parent is null and cannot be retrieved by a
3904+ * call to {@link #getChildAt(int)}.
38883905 *
38893906 * @param child the child to detach
38903907 *
@@ -3899,10 +3916,13 @@ protected void detachViewFromParent(View child) {
38993916 }
39003917
39013918 /**
3902- * Detaches a view from its parent. Detaching a view should be temporary and followed
3903- * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3904- * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached,
3905- * its parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}.
3919+ * Detaches a view from its parent. Detaching a view should be followed
3920+ * either by a call to
3921+ * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3922+ * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be
3923+ * temporary; reattachment or removal should happen within the same drawing cycle as
3924+ * detachment. When a view is detached, its parent is null and cannot be retrieved by a
3925+ * call to {@link #getChildAt(int)}.
39063926 *
39073927 * @param index the index of the child to detach
39083928 *
@@ -3917,10 +3937,13 @@ protected void detachViewFromParent(int index) {
39173937 }
39183938
39193939 /**
3920- * Detaches a range of view from their parent. Detaching a view should be temporary and followed
3921- * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3922- * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached, its
3923- * parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}.
3940+ * Detaches a range of views from their parents. Detaching a view should be followed
3941+ * either by a call to
3942+ * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3943+ * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be
3944+ * temporary; reattachment or removal should happen within the same drawing cycle as
3945+ * detachment. When a view is detached, its parent is null and cannot be retrieved by a
3946+ * call to {@link #getChildAt(int)}.
39243947 *
39253948 * @param start the first index of the childrend range to detach
39263949 * @param count the number of children to detach
@@ -3936,10 +3959,13 @@ protected void detachViewsFromParent(int start, int count) {
39363959 }
39373960
39383961 /**
3939- * Detaches all views from the parent. Detaching a view should be temporary and followed
3940- * either by a call to {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3941- * or a call to {@link #removeDetachedView(View, boolean)}. When a view is detached,
3942- * its parent is null and cannot be retrieved by a call to {@link #getChildAt(int)}.
3962+ * Detaches all views from the parent. Detaching a view should be followed
3963+ * either by a call to
3964+ * {@link #attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)}
3965+ * or a call to {@link #removeDetachedView(View, boolean)}. Detachment should only be
3966+ * temporary; reattachment or removal should happen within the same drawing cycle as
3967+ * detachment. When a view is detached, its parent is null and cannot be retrieved by a
3968+ * call to {@link #getChildAt(int)}.
39433969 *
39443970 * @see #detachViewFromParent(View)
39453971 * @see #detachViewFromParent(int)
0 commit comments