FileDocCategorySizeDatePackage
ViewOverlay.javaAPI DocAndroid 5.1 API12071Thu Mar 12 22:22:10 GMT 2015android.view

ViewOverlay

public class ViewOverlay extends Object
An overlay is an extra layer that sits on top of a View (the "host view") which is drawn after all other content in that view (including children, if the view is a ViewGroup). Interaction with the overlay layer is done by adding and removing drawables.

An overlay requested from a ViewGroup is of type {@link ViewGroupOverlay}, which also supports adding and removing views.

see
View#getOverlay() View.getOverlay()
see
ViewGroup#getOverlay() ViewGroup.getOverlay()
see
ViewGroupOverlay

Fields Summary
OverlayViewGroup
mOverlayViewGroup
The actual container for the drawables (and views, if it's a ViewGroupOverlay). All of the management and rendering details for the overlay are handled in OverlayViewGroup.
Constructors Summary
ViewOverlay(android.content.Context context, View hostView)

        mOverlayViewGroup = new OverlayViewGroup(context, hostView);
    
Methods Summary
public voidadd(android.graphics.drawable.Drawable drawable)
Adds a Drawable to the overlay. The bounds of the drawable should be relative to the host view. Any drawable added to the overlay should be removed when it is no longer needed or no longer visible.

param
drawable The Drawable to be added to the overlay. This drawable will be drawn when the view redraws its overlay.
see
#remove(Drawable)

        mOverlayViewGroup.add(drawable);
    
public voidclear()
Removes all content from the overlay.

        mOverlayViewGroup.clear();
    
ViewGroupgetOverlayView()
Used internally by View and ViewGroup to handle drawing and invalidation of the overlay

return

        return mOverlayViewGroup;
    
booleanisEmpty()

        return mOverlayViewGroup.isEmpty();
    
public voidremove(android.graphics.drawable.Drawable drawable)
Removes the specified Drawable from the overlay.

param
drawable The Drawable to be removed from the overlay.
see
#add(Drawable)

        mOverlayViewGroup.remove(drawable);