Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Neil Gittens
Neil Gittens
1,826 Points

Large Text

I have inserted a Large Text widget in Android studio design view. The text I want to add is to big. When I run it on the device the text is cut off. I am not allowed to scroll to see all the text.

Also it is possible to format areas of the text in the text view. For example I want to make the two words stand out in bold and red.

Mazen Halawi
Mazen Halawi
7,806 Points

You have to use xml's CData and then in the setText method you use the Html.fromHtml(get_the_string_resource_name_here)

in XML:
<string name="test">This is a string example to see how to use CDATA <Data><![CDATA[<b>html</b>]]></Data> in this line.</string>

in Java:
((TextView)findViewById(R.id.textView1)).setText(Html.fromHtml(getResources().getString(R.string.test)));
Neil Gittens
Neil Gittens
1,826 Points

Thanks Mazen. I created a string and put all the text in a cdata tag. I'm working now on scrolling the entire page.

I found out not all the HTML tags work with cData