Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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