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 Adding a Button

Chan Yu
Chan Yu
150 Points

Our Properties button on right side

I am using window 10. As the properties part show in video is not same with my android studio vision. I cannot show the same properties list in video. Say i don't have layoutwidth and height. But i have layout Direction and other things i don't know on that.

1 Answer

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

Hey Chan!

Yep, the Properties field has changed a little bit. Also, they've changed the default layout from RelativeLayout to ConstraintLayout which I think is the issue you're having. Instead of a ConstraintLayout, you should be using a RelativeLayout.

Here's the layout I used if you'd like to take a look:

<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:padding="16dp"
    tools:context=".FunFactsActivity"
    android:background="#51b46d"
    android:id="@+id/relativeLayout">

    <TextView android:text="Did you know?" android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp"
        android:textColor="#80ffffff" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Ants stretch when they wake up in the morning."
        android:id="@+id/factTextView"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:textSize="24sp"
        android:textColor="@android:color/white" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Show Another Fun Fact"
        android:id="@+id/showFactButton"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@android:color/white"
        android:textColor="#51b46d" />

</RelativeLayout>