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 trialLyric Abbott
35,595 Pointshow 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
14,780 PointsHello,
All you need to do is write:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:layout_width="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 :)