2014-02-25 96 views

回答

0

我有一个工作解决方案,虽然它不漂亮。 Android名称空间本身可在http://schemas.android.com/apk/res/android处找到。执行以下操作,我可以匹配的属性的前缀的命名空间:

String prefix = xpp.getAttributePrefix(i); 
if (xpp.getNamespace(prefix) == "http://schemas.android.com/apk/res/android") { 
    // We found it! Save the value of prefix 
} 

在上面的代码中,我将是具有前缀的元素的属性的索引。

我设法通过简单地使用xpp.getAttributeValue("http://schemas.android.com/apk/res/android", attr);找到我想要的而不管实际的前缀。

相关问题