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 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.