Android.Util.IAttributeSet
A collection of attributes, as found associated with a tag in an XML document.

See Also: IAttributeSet Members

Syntax

[Android.Runtime.Register("android/util/AttributeSet", "", "Android.Util.IAttributeSetInvoker")]
public interface IAttributeSet : Android.Runtime.IJavaObject, IDisposable

Remarks

A collection of attributes, as found associated with a tag in an XML document. Often you will not want to use this interface directly, instead passing it to NoType:android/content/res/Resources$Theme;Href=../../../reference/android/content/res/Resources.Theme.html#obtainStyledAttributes(android.util.AttributeSet, int[], int, int) which will take care of parsing the attributes for you. In particular, the Resources API will convert resource references (attribute values such as "@string/my_label" in the original XML) to the desired type for you; if you use AttributeSet directly then you will need to manually check for resource references (with IAttributeSet.GetAttributeResourceValue(int, System.Int32)) and do the resource lookup yourself if needed. Direct use of AttributeSet also prevents the application of themes and styles when retrieving attribute values.

This interface provides an efficient mechanism for retrieving data from compiled XML files, which can be retrieved for a particular XmlPullParser through Xml.AsAttributeSet(System.Xml.XmlReader). Normally this will return an implementation of the interface that works on top of a generic XmlPullParser, however it is more useful in conjunction with compiled XML resources:

java Example

 XmlPullParser parser = resources.getXml(myResouce);
 AttributeSet attributes = Xml.asAttributeSet(parser);

The implementation returned here, unlike using the implementation on top of a generic XmlPullParser, is highly optimized by retrieving pre-computed information that was generated by aapt when compiling your resources. For example, the IAttributeSet.GetAttributeFloatValue(int, System.Single) method returns a floating point number previous stored in the compiled resource instead of parsing at runtime the string originally in the XML file.

This interface also provides additional information contained in the compiled XML resource that is not available in a normal XML file, such as IAttributeSet.GetAttributeNameResource(int) which returns the resource identifier associated with a particular XML attribute name.

[Android Documentation]

Requirements

Namespace: Android.Util
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1