IT. Expert System.

Android Reference

StateListDrawable


android.graphics.drawable

Class StateListDrawable

  • All Implemented Interfaces:
    Drawable.Callback


    public class StateListDrawable
    extends DrawableContainer
    Lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string ID value.

    It can be defined in an XML file with the <selector> element. Each state Drawable is defined in a nested <item> element. For more information, see the guide to Drawable Resources.

    • Constructor Detail

      • StateListDrawable

        public StateListDrawable()
    • Method Detail

      • addState

        public void addState(int[] stateSet,
                    Drawable drawable)
        Add a new image/string ID to the set of images.
        Parameters:
        stateSet - - An array of resource Ids to associate with the image. Switch to this image by calling setState().
        drawable - -The image to show.
      • isStateful

        public boolean isStateful()
        Description copied from class: Drawable
        Indicates whether this view will change its appearance based on state. Clients can use this to determine whether it is necessary to calculate their state and call setState.
        Overrides:
        isStateful in class DrawableContainer
        Returns:
        True if this view changes its appearance based on state, false otherwise.
        See Also:
        Drawable.setState(int[])
      • onStateChange

        protected boolean onStateChange(int[] stateSet)
        Description copied from class: Drawable
        Override this in your subclass to change appearance if you recognize the specified state.
        Overrides:
        onStateChange in class DrawableContainer
        Returns:
        Returns true if the state change has caused the appearance of the Drawable to change (that is, it needs to be drawn), else false if it looks the same and there is no need to redraw it since its last state.
      • getStateCount

        public int getStateCount()
        Gets the number of states contained in this drawable.
        Returns:
        The number of states contained in this drawable.
        See Also:
        getStateSet(int), getStateDrawable(int)
      • getStateSet

        public int[] getStateSet(int index)
        Gets the state set at an index.
        Parameters:
        index - The index of the state set.
        Returns:
        The state set at the index.
        See Also:
        getStateCount(), getStateDrawable(int)
      • getStateDrawable

        public Drawable getStateDrawable(int index)
        Gets the drawable at an index.
        Parameters:
        index - The index of the drawable.
        Returns:
        The drawable at the index.
        See Also:
        getStateCount(), getStateSet(int)
      • getStateDrawableIndex

        public int getStateDrawableIndex(int[] stateSet)
        Gets the index of the drawable with the provided state set.
        Parameters:
        stateSet - the state set to look up
        Returns:
        the index of the provided state set, or -1 if not found
        See Also:
        getStateDrawable(int), getStateSet(int)
      • mutate

        public Drawable mutate()
        Description copied from class: Drawable
        Make this drawable mutable. This operation cannot be reversed. A mutable drawable is guaranteed to not share its state with any other drawable. This is especially useful when you need to modify properties of drawables loaded from resources. By default, all drawables instances loaded from the same resource share a common state; if you modify the state of one instance, all the other instances will receive the same modification. Calling this method on a mutable Drawable will have no effect.
        Overrides:
        mutate in class DrawableContainer
        Returns:
        This drawable.
        See Also:
        Drawable.ConstantState, Drawable.getConstantState()


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 525 / 158861798. Delta: 0.04802 с