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 Build an Interactive Story App (Retired) Finishing the User Interface Creating the Story Layout

Benoit Plante
Benoit Plante
6,474 Points

Changing text size

How do I change the text size of storyTextView? I tried to edit textSize, and it seems to work in the preview, but when I run the app in the emulator the text is still small.

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Benoit;

In your layout .xml file for your TextView item you should be able to add :

android:textSize="42sp"

Or whatever size you want. Remember to use sp for text sizes instead of dp.

What code have you tried that is giving you issues?

Ken

Benoit Plante
Benoit Plante
6,474 Points

Thanks, I used dp, now it works.

Benoit Plante
Benoit Plante
6,474 Points

By the way, I could I adapt the text size to the screen? For example, for the Nexus 7, it needs size=26sp to fill the screen, but it is too large for Nexus 5...

The other parts of the layout scale correctly.