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 a Simple Android App (2014) Creating the Screen Layout Changing Text in a Layout

How to change text in the following code?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >

<TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Treehouse" android:textSize="16sp" />

</RelativeLayout>

Sante Kotturi
Sante Kotturi
7,434 Points

Can you elaborate your question? Are you stuck on this question? If so, can you please post the code so we can help you solve the current issue, thanks!

1 Answer

Daniel Hartin
Daniel Hartin
18,106 Points

Hi Aravind

Like Sante has said it is preferable for you to post your code highlighting which particular area you are struggling with.

I'm going to take a guess and say that you are not quite sure how to change the text in the XML code shown in the code challenge.

You should look at the following line

android:text="I love Treehouse!"

The android:text statement is what is used to declare the string (or text) which will appear in the item which the statement is contained within. Simply change this text to:

android:text="Treehouse loves me!"

Hope this helps

Daniel