public class StyleResourceValueImpl extends ResourceValueImpl implements StyleResourceValue
ResourceValue.mNamespaceResolver| Constructor and Description |
|---|
StyleResourceValueImpl(ResourceNamespace namespace,
java.lang.String name,
java.lang.String parentStyle,
java.lang.String libraryName)
Creates a new
StyleResourceValueImpl. |
StyleResourceValueImpl(ResourceReference reference,
java.lang.String parentStyle,
java.lang.String libraryName)
Creates a new
StyleResourceValueImpl. |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(StyleItemResourceValue item)
Adds a style item to this style.
|
static StyleResourceValueImpl |
copyOf(StyleResourceValue style)
Creates a copy of the given style.
|
java.util.Collection<StyleItemResourceValue> |
getDefinedItems()
Returns a list of all items defined in this Style.
|
StyleItemResourceValue |
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).
|
StyleItemResourceValue |
getItem(ResourceReference attr)
Finds the item for the given attr in this style (if it's defined in this style).
|
java.lang.String |
getParentStyleName()
Returns value of the
parent XML attribute of this style. |
void |
replaceWith(ResourceValue style)
Sets the value from another resource.
|
asReference, equals, getLibraryName, getName, getNamespace, getNamespaceResolver, getResourceType, getValue, hashCode, isFramework, isUserDefined, setNamespaceResolver, setValue, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetParentStyleasReference, getLibraryName, getName, getNamespace, getNamespaceResolver, getRawXmlValue, getReference, getResourceType, getResourceUrl, getValue, isFramework, isUserDefined, setValuepublic StyleResourceValueImpl(@NonNull
ResourceNamespace namespace,
@NonNull
java.lang.String name,
@Nullable
java.lang.String parentStyle,
@Nullable
java.lang.String libraryName)
StyleResourceValueImpl.
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.
public StyleResourceValueImpl(@NonNull
ResourceReference reference,
@Nullable
java.lang.String parentStyle,
@Nullable
java.lang.String libraryName)
StyleResourceValueImpl.@NonNull public static StyleResourceValueImpl copyOf(@NonNull StyleResourceValue style)
@Nullable public java.lang.String getParentStyleName()
StyleResourceValueparent XML attribute of this style. Unlike
StyleResourceValue.getParentStyle(), does not try to determine the name of the parent style by
removing the last component of the name of this style.getParentStyleName in interface StyleResourceValue@Nullable public StyleItemResourceValue getItem(@NonNull ResourceNamespace namespace, @NonNull java.lang.String name)
StyleResourceValuegetItem in interface StyleResourceValue@Nullable public StyleItemResourceValue getItem(@NonNull ResourceReference attr)
StyleResourceValuegetItem in interface StyleResourceValue@NonNull public java.util.Collection<StyleItemResourceValue> getDefinedItems()
StyleResourceValuegetDefinedItems in interface StyleResourceValuepublic void addItem(@NonNull
StyleItemResourceValue item)
item - the style item to addpublic void replaceWith(@NonNull
ResourceValue style)
ResourceValueImplreplaceWith in class ResourceValueImplstyle - the resource value