我有以下代码:遍历一个枚举的AttributeSet
private static boolean hasTargetStyle(AttributeSet attributes) {
final Enumeration<?> attributeNames = attributes.getAttributeNames();
while (attributeNames.hasMoreElements()) {
final Object attributeName = attributeNames.nextElement();
if (attributeName.equals(MY_STYLE_NAME)) {
return true;
}
}
return false;
}
现在我认为这个代码将逐步完成每个属性名称的。但它只给我所有其他属性名称(具有偶数索引的名称)。
这里怎么回事?
你的代码看起来不错;这个问题可能与输入'AttributeSet'有关。 – 2011-05-25 14:22:07
我们可以看到'AttributeSet'吗? – mre 2011-05-25 14:26:58