public final class StyleResourceValue extends ResourceValue
ResourceValue.mNamespaceResolver, mValue| Constructor and Description |
|---|
StyleResourceValue(ResourceReference reference,
java.lang.String parentStyle,
java.lang.String libraryName)
Creates a new
StyleResourceValue. |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(ItemResourceValue item) |
java.util.Collection<ItemResourceValue> |
getDefinedItems()
Returns a list of all items defined in this Style.
|
ItemResourceValue |
getItem(ResourceNamespace namespace,
java.lang.String name)
Finds the item for the given qualified attr name in this style (if it's defined in this
style).
|
ItemResourceValue |
getItem(ResourceReference attr)
Finds the item for the given attr in this style (if it's defined in this style).
|
ResourceReference |
getParentStyle()
Returns a reference to the parent style, if it can be determined based on the explicit parent
reference in XML or by splitting the name of this
StyleResourceValue by dots. |
java.lang.String |
getParentStyleName()
Returns value of the
parent XML attribute of this style. |
void |
replaceWith(ResourceValue style)
Sets the value from another resource.
|
equals, getLibraryName, getRawXmlValue, getReference, getValue, hashCode, isUserDefined, setNamespaceLookup, setValue, toStringgetName, getNamespace, getRelativeResourceUrl, getResourceType, getResourceUrl, isFrameworkpublic StyleResourceValue(@NonNull
ResourceReference reference,
@Nullable
java.lang.String parentStyle,
@Nullable
java.lang.String libraryName)
StyleResourceValue.
Note that names of styles have more meaning than other resources: if the parent attribute
is not set, aapt looks for a dot in the style name and treats the string up to the last dot
as the name of a parent style. So <style name="Foo.Bar.Baz"> has an implicit parent
called Foo.Bar. Setting the parent XML attribute disables this feature, even
if it's set to an empty string. See ResourceParser::ParseStyle in aapt for details.
@Nullable public java.lang.String getParentStyleName()
parent XML attribute of this style. Does not look at the name of
the style itself or dots in it.@Nullable public ResourceReference getParentStyle()
StyleResourceValue by dots.@Nullable public ItemResourceValue getItem(@NonNull ResourceNamespace namespace, @NonNull java.lang.String name)
@Nullable public ItemResourceValue getItem(@NonNull ResourceReference attr)
public void addItem(ItemResourceValue item)
public void replaceWith(ResourceValue style)
ResourceValuereplaceWith in class ResourceValuestyle - the resource valuepublic java.util.Collection<ItemResourceValue> getDefinedItems()