How to write character & in android strings.xml
Encode it:
&
How can I write character ' in Android's strings.xml?
From the Documentation:
<string name="good_example">"This'll work"</string>
<string name="good_example_2">This\'ll also work</string>
writing some characters like ' ' in an xml file
Use
<
for <
>
for >
&
for &
Android Xml - How do you write '@' character in the string?
This should do the trick:
<string name="gmail">\@ gmail.com</string>
@ is, of course, the way you reference identified resources (@+id\textview) which requires escaping to use.
Pretty sure that formatted="false" does not flag Android to avoid looking up identifiers.
How to type apostrophe character in android strings xml
1. For Single Quote (')
You can use \'
in your string resources.
or
You can can enclose the string in double quotes. For example:
"This'll work"
will simply become This'll work
once parsed
2. For double quote (")
"message \"quote string 1\" and \"quote string 2\" end message"
3. To represent in views xml (eg layout.xml), you have to use HTML character entities (like ")
"message "quoted string 1" and "quoted string 2" end message"
Though Android Studio in particular will complain about hardcoded strings and tell you to use a string resource in layout files instead of course!
Trying to write a the symbol '%' in strings.xml
It seems that there was no reason to do String.format() when just retrieving the string would automatically handle the formatting for me.
So it just becomes:
@JvmStatic
fun formatPercentageText(context: Context, percentage: Float): String {
return context.resources.getString(
R.string.work_package_percent_complete,
percentage
)
}
Write % in strings.xml of android
You can use its code. Try this: %
Also check the similar question: Android XML Percent Symbol
Related Topics
Android Animation Is Not Finished in Onanimationend
How to Display Custom View in Actionbar
Multiline Edittext with Done Softinput Action Label on 2.3
How to Enable Logging for Apache Commons Httpclient on Android
Usb Device Access Pop-Up Suppression
Using Viewpagerindicator Library with Android Studio and Gradle
Show Timepicker with Minutes Intervals in Android
Google Cloud Endpoints and User's Authentication
Google Signin Not Working in Release Mode APK Android
Android Dependency Has Different Version for the Compile and Runtime
Admob Error in Eclipse for Android:Configchanges
Adt 22.2 New App Wizard: Unsupported Template Dependency: Upgrade Your Android Eclipse Plugin
Incompatibleclasschangeerror After Updating to Android Build Tools 25.1.6 Gcm/Fcm
How to Generate a Thumbnail from a Video Url in Android
Upload Photo to Facebook with Facebook Android Sdk in Android