本文整理匯總了Java中android.util.AttributeSet.getAttributeNameResource方法的典型用法代碼示例。如果您正苦於以下問題:Java AttributeSet.getAttributeNameResource方法的具體用法?Java AttributeSet.getAttributeNameResource怎麽用?Java AttributeSet.getAttributeNameResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.util.AttributeSet
的用法示例。
在下文中一共展示了AttributeSet.getAttributeNameResource方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: extractStateSet
import android.util.AttributeSet; //導入方法依賴的package包/類
/**
* Extracts state_ attributes from an attribute set.
*
* @param attrs The attribute set.
* @return An array of state_ attributes.
*/
protected int[] extractStateSet(AttributeSet attrs) {
int j = 0;
final int numAttrs = attrs.getAttributeCount();
int[] states = new int[numAttrs];
for (int i = 0; i < numAttrs; i++) {
final int stateResId = attrs.getAttributeNameResource(i);
if (stateResId == 0) {
break;
} else if (stateResId == android.R.attr.drawable
|| stateResId == android.R.attr.id
|| stateResId == R.attr.drawableTint
|| stateResId == R.attr.drawableTintMode) {
// Ignore attributes from StateListDrawableItem and
// AnimatedStateListDrawableItem.
continue;
} else {
states[j++] = attrs.getAttributeBooleanValue(i, false)
? stateResId : -stateResId;
}
}
states = StateSet.trimStateSet(states, j);
return states;
}
示例2: extractStateSet
import android.util.AttributeSet; //導入方法依賴的package包/類
protected static int[] extractStateSet(AttributeSet attrs) {
int j = 0;
final int numAttrs = attrs.getAttributeCount();
int[] states = new int[numAttrs];
for (int i = 0; i < numAttrs; i++) {
final int stateResId = attrs.getAttributeNameResource(i);
switch (stateResId) {
case 0:
break;
case android.R.attr.color:
case android.R.attr.alpha:
// Ignore attributes from StateListDrawableItem and
// AnimatedStateListDrawableItem.
continue;
default:
states[j++] = attrs.getAttributeBooleanValue(i, false)
? stateResId : -stateResId;
}
}
states = StateSet.trimStateSet(states, j);
return states;
}
示例3: getAttributeValue
import android.util.AttributeSet; //導入方法依賴的package包/類
public static int getAttributeValue(AttributeSet attr, int paramInt) {
int value = -1;
int count = attr.getAttributeCount();
for (int i = 0; i < count; i++) {
if (attr.getAttributeNameResource(i) == paramInt) {
String str = attr.getAttributeValue(i);
if (null != str && str.startsWith("?")) {
value = Integer.valueOf(str.substring(1, str.length())).intValue();
return value;
}
}
}
return value;
}
示例4: getAttributeValue
import android.util.AttributeSet; //導入方法依賴的package包/類
public static int getAttributeValue(AttributeSet attr, int paramInt) {
int value = -1;
int count = attr.getAttributeCount();
for(int i = 0; i <count;i++) {
if(attr.getAttributeNameResource(i) == paramInt) {
String str = attr.getAttributeValue(i);
if(null != str && str.startsWith("?")) {
value = Integer.valueOf(str.substring(1,str.length())).intValue();
return value;
}
}
}
return value;
}
示例5: getSrcId
import android.util.AttributeSet; //導入方法依賴的package包/類
private static int getSrcId(AttributeSet attrs) {
int count = attrs.getAttributeCount();
for (int i = 0; i < count; i++) {
if (attrs.getAttributeNameResource(i) == android.R.attr.src) {
String str = attrs.getAttributeValue(i);
return Integer.valueOf(str.substring(1, str.length()));
}
}
return -1;
}