Most visited

Recently visited

Added in API level 1

StateSet

public class StateSet
extends Object

java.lang.Object
    android.util.StateSet


状态集是正整数的数组,其中每个元素表示View的状态(例如,聚焦,选定,可见等)。 一个View可能处于一个或多个这些状态。 甲状态规范是签署整数数组,其中每个元素表示需要(如果正)或不期望的(如果负) View状态。 实用程序处理状态集。 在理论上,我们可以封装状态集和状态规范数组,并且在这里没有静态方法,但是由于在视图绘制期间调用了这些方法,所以存在对性能的一些关注。

摘要(Summary)

Fields

public static final int[] NOTHING

一个不包含任何有效状态的状态集。

public static final int[] WILD_CARD

一个状态规范将被所有StateSets匹配。

公共方法(Public methods)

static String dump(int[] states)
static boolean isWildCard(int[] stateSetOrSpec)

返回stateSetOrSpec是否与所有StateSets匹配。

static boolean stateSetMatches(int[] stateSpec, int[] stateSet)

返回stateSet是否与所需的stateSpec匹配。

static boolean stateSetMatches(int[] stateSpec, int state)

返回状态是否与所需的stateSpec匹配。

static int[] trimStateSet(int[] states, int newSize)

继承方法(Inherited methods)

From class java.lang.Object

Fields

NOTHING

Added in API level 11
int[] NOTHING

一个不包含任何有效状态的状态集。

WILD_CARD

Added in API level 1
int[] WILD_CARD

一个状态规范将被所有StateSets匹配。

公共方法(Public methods)

dump

Added in API level 1
String dump (int[] states)

参数(Parameters)
states int
返回(Returns)
String

isWildCard

Added in API level 1
boolean isWildCard (int[] stateSetOrSpec)

返回stateSetOrSpec是否与所有StateSets匹配。

参数(Parameters)
stateSetOrSpec int: a state set or state spec.
返回(Returns)
boolean

stateSetMatches

Added in API level 1
boolean stateSetMatches (int[] stateSpec, 
                int[] stateSet)

返回stateSet是否与所需的stateSpec匹配。

参数(Parameters)
stateSpec int: an array of required (if positive) or prohibited (if negative) View states.
stateSet int: an array of View states
返回(Returns)
boolean

stateSetMatches

Added in API level 1
boolean stateSetMatches (int[] stateSpec, 
                int state)

返回状态是否与所需的stateSpec匹配。

参数(Parameters)
stateSpec int: an array of required (if positive) or prohibited (if negative) View states.
state int: a View state
返回(Returns)
boolean

trimStateSet

Added in API level 1
int[] trimStateSet (int[] states, 
                int newSize)

参数(Parameters)
states int
newSize int
返回(Returns)
int[]

Hooray!