Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8016231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:29:02+00:00 2026-06-04T20:29:02+00:00

In my strings.xml file I have defined the following: <string name=mystring><b>Bold text</b>Non-bold text</string> It

  • 0

In my strings.xml file I have defined the following:

<string name="mystring"><b>Bold text</b>Non-bold text</string>

It should work, as it’s specified here. But actually only bold text is displayed, and the other part of text is gone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:29:03+00:00Added an answer on June 4, 2026 at 8:29 pm

    taken from this SO thread

    use this

    textView.setText(Html.fromHtml(someText));
    

    or from xml by this way

    You CAN include raw HTML in strings.xml, as long as you wrap it in

    <![CDATA[ ...raw html... ]]>
    

    Example:

    <string name="nice_html">
    <![CDATA[
    <p>This is a html-formatted string with <b>bold</b> and <i>italic</i> text</p>
    <p>This is another paragraph of the same string.</p>
    ]]>
    </string>
    

    Then, in your code:

    TextView foo = (TextView)findViewById(R.id.foo);
    foo.setText(Html.fromHtml(getString(R.string.nice_html)));
    

    you can also backslash-escape apostrophes/single-quotes inside the CDATA block, so you can have things like <b>can\'t</b> instead of the infinitely-uglier <b>can&apos;t</b>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following TextView in my XML layout file:- <TextView android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/autolink_test
I have the following contents in my XML file: <items> <item id=1><content><![CDATA[<p>string</p>]]></content></item> </items> I
I have xml file whose structure is defined with following xsd: <?xml version=1.0 encoding=utf-8?>
I have something like the following (shown below) defined in my styles.xml file. But
I wanted to define the string name of my intent in the strings.xml file,
I have an array defined in my strings.xml file names. I want the values
I have a string in xml file This is a subpara (10.1), subpara (1)
HI, I have some string from XML file, and I I want to replace
Possible Duplicate: Enforcing spaces in string resources This is the strings.xml file I use
Can I count on string arrays within the strings.xml resource file to be parsed/deserialized

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.