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!

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


how do you do this?

We just saw how adding a Button generates the XML for us. Now let's write the XML by hand. Start simple by adding a Button element. Copy and paste the TextView element and just change 'TextView' to 'Button'.


1 Answer

Harry James
Harry James
14,780 Points


All you need to do is write:

    android:layout_height="wrap_content" />

    android:layout_height="wrap_content" />

Creating a TextView or a Button are exactly the same in XML so, all you need to do is copy the TextView object then paste it but, replace its type with "Button" instead :)