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.

dantesolis
8,842 PointsStage 3.5 : Positioning text/ Layouts :colors, sizes, and weights
I seem to have lost the text on my textView, I cannot no longer see it on my emulator. Can someone please tell if I somehow hid it??
'''activy_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scaleType="fitCenter"
android:src="@drawable/ball01" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:text="Enlighten Me!"
android:textColor="#3f0f7f"
android:textColorLink="#3f0f7f"
android:textSize="24sp"
android:textStyle="bold|italic"
android:typeface="serif" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:weightSum="1" >
<View
android:id="@+id/view1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.2" />
<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.6"
android:gravity="center_horizontal"
android:shadowColor="@android:color/white"
android:textColor="@android:color/white"
android:textSize="32sp"
android:textStyle="bold|italic" />
<View
android:id="@+id/view2"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.2" />
</LinearLayout>
</RelativeLayout>'''
1 Answer

Steve Wamsley
7,977 PointsAdd an android:text attribute to the <TextView> element:
<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.6"
android:gravity="center_horizontal"
android:shadowColor="@android:color/white"
android:textColor="@android:color/white"
android:textSize="32sp"
android:textStyle="bold|italic"
android:text="The text to display" />