Share via


ViewGroupOverlay.Add(View) Method

Definition

Adds a View to the overlay.

[Android.Runtime.Register("add", "(Landroid/view/View;)V", "GetAdd_Landroid_view_View_Handler")]
public virtual void Add (Android.Views.View view);
[<Android.Runtime.Register("add", "(Landroid/view/View;)V", "GetAdd_Landroid_view_View_Handler")>]
override this.Add : Android.Views.View -> unit

Parameters

view
View

The View to be added to the overlay. The added view will be drawn when the overlay is drawn.

Attributes

Remarks

Adds a View to the overlay. The bounds of the added view should be relative to the host view. Any view added to the overlay should be removed when it is no longer needed or no longer visible.

Views in the overlay are visual-only; they do not receive input events and do not participate in focus traversal. Overlay views are intended to be transient, such as might be needed by a temporary animation effect.

If the view has a parent, the view will be removed from that parent before being added to the overlay. Also, if that parent is attached in the current view hierarchy, the view will be repositioned such that it is in the same relative location inside the activity. For example, if the view's current parent lies 100 pixels to the right and 200 pixels down from the origin of the overlay's host view, then the view will be offset by (100, 200).

Views added with this API will be drawn in the order they were added. Drawing of the overlay views will happen before drawing of any of the Drawables added with #add(Drawable) API even if a call to this API happened after the call to #add(Drawable).

Passing null parameter will result in an IllegalArgumentException being thrown.

Java documentation for android.view.ViewGroupOverlay.add(android.view.View).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also