Added in API level 18

ViewOverlay


public class ViewOverlay
extends Object

java.lang.Object
   ↳ android.view.ViewOverlay
ViewGroupOverlay A group overlay is an extra layer that sits on top of a ViewGroup (the "host view") which is drawn after all other content in that view (including the view group's children). 


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 ViewGroupOverlay, which also supports adding and removing views.

Summary

Public methods

void add(Drawable drawable)

Adds a Drawable to the overlay.

void clear()

Removes all content from the overlay.

void remove(Drawable drawable)

Removes the specified Drawable from the overlay.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public methods

add

Added in API level 18
public void add (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. Adding an already existing Drawable is a no-op. Passing null parameter will result in an IllegalArgumentException being thrown.

Parameters
drawable Drawable: The Drawable to be added to the overlay. This drawable will be drawn when the view redraws its overlay. Drawables will be drawn in the order that they were added. This value cannot be null.

See also:

clear

Added in API level 18
public void clear ()

Removes all content from the overlay.

remove

Added in API level 18
public void remove (Drawable drawable)

Removes the specified Drawable from the overlay. Removing a Drawable that was not added with add(android.graphics.drawable.Drawable) is a no-op. Passing null parameter will result in an IllegalArgumentException being thrown.

Parameters
drawable Drawable: The Drawable to be removed from the overlay. This value cannot be null.

See also: