AnimatedStateElementpublic class StateElement extends ElementContainer
Element object that can be changed based on the component state.
Multiple Element objects are contained in the ElementContainer, but only one is valid.
The validity is implemented by ComponentState.
Element.ConstantState, Element.OnBoundsChangeListener, Element.OnChangeListener, Element.OnLayoutDirectionChangeListener, Element.OnRankChangeListenerElementContainer.ElementStateALPHA_DEFAULT, ALPHA_MAX, ALPHA_MIN, DEFAULT_BOUNDS_RECT, MAX_RANK, MIN_RANK| 构造器 | 说明 |
|---|---|
StateElement() |
Default constructor used to create a
StateElement object. |
StateElement(Context context,
int xmlId) |
Creates a
StateElement object based on the specified XML resource. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addState(int[] stateSet,
Element element) |
Places a state set and an
Element object in a container. |
int |
findStateElementIndex(int[] stateSet) |
Searches for an index in the state set.
|
Element |
getCurrentElement() |
Obtains the
Element object in use. |
int |
getStateCount() |
Counts the number of state sets.
|
Element |
getStateElement(int index) |
Finds an
Element object based on a specified index. |
int[] |
getStateSet(int index) |
Obtains the state set based on a specified index.
|
clearColorMatrix, drawToCanvas, getAlpha, getBounds, getCallback, getColorMatrix, getHeight, getLayoutDirection, getMinHeight, getMinWidth, getPadding, getRank, getStateColorMode, getVisible, getWidth, isInheritDirection, isVisible, release, setAlpha, setBounds, setBounds, setCallback, setColorMatrix, setInheritDirection, setLayoutDirection, setOnBoundsChangeListener, setOnLayoutDirectionChangeListener, setOnRankChangeListener, setRank, setStateColor, setStateColorList, setStateColorMode, setVisibleaddChildElement, getChildElement, getChildElementCount, getElementState, getEnterFadeDuration, getExitFadeDuration, getFadeInEffectPeriod, getFadeOutEffectPeriod, isStateful, selectElement, setElementState, setEnterFadeDuration, setExitFadeDuration, skipAnimationpublic StateElement()
StateElement object.public StateElement(Context context, int xmlId)
StateElement object based on the specified XML resource.context - Indicates the application context.xmlId - Indicates the ID of the XML resource.public Element getCurrentElement()
Element object in use.getCurrentElement 在类中 ElementContainerElement object in use in normal cases; returns the child Element object in
use if an ElementContainer is used.public void addState(int[] stateSet,
Element element)
Element object in a container.
The state set and Element object appear in pairs.
stateSet - Indicates a state set, represented by an array.
A negative number indicates a non-matching state.
If the array is empty or contains only 0, any state is matched.
Generally, the value of an array is obtained from ComponentState.element - Indicates the Element object to be displayed in a specified state set.
Only the Element object that does not change with the state can be added.public int findStateElementIndex(int[] stateSet)
stateSet - Indicates a state set.-1 if the state set does not exist.public int[] getStateSet(int index)
index - Indicates an index.public Element getStateElement(int index)
Element object based on a specified index.index - Indicates an index.Element object.public int getStateCount()