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 Creating the Screen Layout Setting a Fullscreen Theme

Uzair Khan
Uzair Khan
3,640 Points

When i run the application on the emulator all of the fun text is written over each other

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="50dp" android:paddingLeft="50dp" android:paddingRight="50dp" android:paddingTop="50dp" android:background="#51b46d" tools:context="com.example.uzair1996.funapplication.FunActivity">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Did you know!!"
    android:textColor="@color/colorPrimaryDark"
    android:textSize="18sp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="0.457"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.143" />

<TextView
    android:id="@+id/factTextView"
    android:layout_width="359dp"
    android:layout_height="68dp"
    android:text="Ants stretch when they wake up in the morning."
    android:textColor="#ffffffff"
    android:textSize="24sp"
    tools:layout_editor_absoluteX="13dp"
    tools:layout_editor_absoluteY="221dp" />

<Button
    android:id="@+id/showFactButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#ffffffff"
    android:text="Show Another Fun Fact"
    android:textSize="18sp"
    tools:layout_editor_absoluteX="66dp"
    tools:layout_editor_absoluteY="457dp" />

</RelativeLayout>

1 Answer

Jason Wiram
Jason Wiram
42,762 Points

When using a RelativeLayout you'll want to use layout properties like the following:

android:layout_below="@+id/factTextView"

This will allow you to position elements relative you each other using their ids. Also, remember that anything prefixed with "tools:" will only have an effect while developing and not when you run your code/app.