bloodscript bloodscript - 1 year ago 137
Android Question

Styling/Formatting an Android String resource

Im trying to fill an activity with a huge string.
I formatted so there are new lines and bold font. Now i want the title to have a bigger font size and "\t" also doesnt work.
Do you have ans ideas how to do a tabulator and font resizing?
I dont want to change anything inside my activity to keep it as generic as possible. I need it for 15 different things...

I just load the string into a textview inside a scrollview. I may use a fragment for the title but i would more like to resize the font. And i dont have any idea for the tabulator.

Answer Source

You might want to do this:

Use html format. Put your string with html format e.g: <p>test&#09;1<p>.

&#09; is ASCII code for \t.

If you put your string on string.xml, put like this:

<string name="test"><![CDATA[<p>test&#09;1<p>]]></string>

and on Java, get the string by calling Html.fromHtml(getString(R.string.test))

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download