Added in API level 1

StateSet


open class StateSet
kotlin.Any
   ↳ android.util.StateSet

State sets are arrays of positive ints where each element represents the state of a android.view.View (e.g. focused, selected, visible, etc.). A android.view.View may be in one or more of those states. A state spec is an array of signed ints where each element represents a required (if positive) or an undesired (if negative) android.view.View state. Utils dealing with state sets. In theory we could encapsulate the state set and state spec arrays and not have static methods here but there is some concern about performance since these methods are called during view drawing.

Summary

Public methods
open static String!
dump(states: IntArray!)

open static Boolean
isWildCard(stateSetOrSpec: IntArray!)

Return whether the stateSetOrSpec is matched by all StateSets.

open static Boolean
stateSetMatches(stateSpec: IntArray!, stateSet: IntArray!)

Return whether the stateSet matches the desired stateSpec.

open static Boolean
stateSetMatches(stateSpec: IntArray!, state: Int)

Return whether the state matches the desired stateSpec.

open static IntArray!
trimStateSet(states: IntArray!, newSize: Int)

Properties
static IntArray!

A state set that does not contain any valid states.

static IntArray!

A state specification that will be matched by all StateSets.

Public methods

dump

Added in API level 1
open static fun dump(states: IntArray!): String!

isWildCard

Added in API level 1
open static fun isWildCard(stateSetOrSpec: IntArray!): Boolean

Return whether the stateSetOrSpec is matched by all StateSets.

Parameters
stateSetOrSpec IntArray!: a state set or state spec.

stateSetMatches

Added in API level 1
open static fun stateSetMatches(
    stateSpec: IntArray!,
    stateSet: IntArray!
): Boolean

Return whether the stateSet matches the desired stateSpec.

Parameters
stateSpec IntArray!: an array of required (if positive) or prohibited (if negative) android.view.View states.
stateSet IntArray!: an array of android.view.View states

stateSetMatches

Added in API level 1
open static fun stateSetMatches(
    stateSpec: IntArray!,
    state: Int
): Boolean

Return whether the state matches the desired stateSpec.

Parameters
stateSpec IntArray!: an array of required (if positive) or prohibited (if negative) android.view.View states.
state Int: a android.view.View state

trimStateSet

Added in API level 1
open static fun trimStateSet(
    states: IntArray!,
    newSize: Int
): IntArray!

Properties

NOTHING

Added in API level 11
static val NOTHING: IntArray!

A state set that does not contain any valid states.

WILD_CARD

Added in API level 1
static val WILD_CARD: IntArray!

A state specification that will be matched by all StateSets.