annotatedStringResource
Load an annotated string resource with formatting.
<string name="hello">Hello, <annotation variable="who" color="main">.</annotation>!</string>
annotatedStringResource(
id = R.string.hello,
formatArgs = persistentMapOf("who" to "Bob"),
)
Beware, when using annotations with a variable
mapping (<annotation variable="...">
):
The annotation content must not be empty, otherwise it will be stripped by AAPT. You can use a space, a dot, or anything else.
The entire annotation content will be replaced by the provided argument mapping.
If the argument mapping is not found, a NoSuchElementException will be thrown!
Return
the AnnotatedString data associated with the resource
Parameters
the resource identifier
the format arguments
Load a annotated string resource.
Return
the AnnotatedString data associated with the resource
Parameters
the resource identifier
Deprecated
Use the annotatedStringResource with PersistentMap overload instead
Replace with
annotatedStringResource(id, persistentMapOf(formatArgs))
Load a annotated string resource with formatting.
Be aware that using this method you'll loose the annotations support.
Return
the AnnotatedString data associated with the resource
Parameters
the resource identifier
the format arguments