ImageSwitcher


public class ImageSwitcher
extends ViewSwitcher

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.widget.ViewAnimator
           ↳ android.widget.ViewSwitcher
             ↳ android.widget.ImageSwitcher


ViewSwitcher that switches between two ImageViews when a new image is set on it. The views added to an ImageSwitcher must all be ImageViews.

Summary

Inherited XML attributes

Inherited constants

Inherited fields

Public constructors

ImageSwitcher(Context context)

Creates a new empty ImageSwitcher.

ImageSwitcher(Context context, AttributeSet attrs)

Creates a new empty ImageSwitcher for the given context and with the specified set attributes.

Public methods

CharSequence getAccessibilityClassName()

Return the class name of this object to be used for accessibility purposes.

void setImageDrawable(Drawable drawable)

Sets a new drawable on the ImageSwitcher.

void setImageResource(int resid)

Sets a new image on the ImageSwitcher with the given resource id.

void setImageURI(Uri uri)

Sets a new image on the ImageSwitcher with the given Uri.

Inherited methods

Public constructors

ImageSwitcher

Added in API level 1
public ImageSwitcher (Context context)

Creates a new empty ImageSwitcher.

Parameters
context Context: the application's environment

ImageSwitcher

Added in API level 1
public ImageSwitcher (Context context, 
                AttributeSet attrs)

Creates a new empty ImageSwitcher for the given context and with the specified set attributes.

Parameters
context Context: the application environment

attrs AttributeSet: a collection of attributes

Public methods

getAccessibilityClassName

Added in API level 23
public CharSequence getAccessibilityClassName ()

Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely new class of view when used by accessibility, unrelated to the class it is deriving from. This is used to fill in AccessibilityNodeInfo.setClassName.

Returns
CharSequence

setImageDrawable

Added in API level 1
public void setImageDrawable (Drawable drawable)

Sets a new drawable on the ImageSwitcher. This will set that drawable on the next ImageView in the switcher and will then switch to that view.

Parameters
drawable Drawable: the drawable to be set or null to clear the content

setImageResource

Added in API level 1
public void setImageResource (int resid)

Sets a new image on the ImageSwitcher with the given resource id. This will set that image resource on the next ImageView in the switcher and will then switch to that view.

Parameters
resid int: a Drawable resource id

setImageURI

Added in API level 1
public void setImageURI (Uri uri)

Sets a new image on the ImageSwitcher with the given Uri. This will set that image on the next ImageView in the switcher and will then switch to that view.

Parameters
uri Uri: the Uri of an image