我有以下代碼:遍歷一個枚舉的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