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.

Benjamin Hoopes
647 PointsAdd a Button inside this RelativeLayout. Don’t add any attributes yet.
Hi, I'm on the code challenge above and trying to add a button inside the relative layout in xml, but getting the error "Bummer! Don't forget your opening and closing Button tags (or combined as one empty tag). Make sure your Button element is inside the opening and closing tags for the RelativeLayout." My code is below, can someone please help me figure out what I'm missing?
<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"
tools:context=".MainActivity" >
<button
android:id="@android:id/button1"/>
</RelativeLayout>
5 Answers

James Barnett
39,199 PointsWhere is your closing button tag?

Benjamin Hoopes
647 PointsLooks like my code didn't make it, here it is:
<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" tools:context=".MainActivity" >
<button android:id="@android:id/button1"/>
</RelativeLayout>

Benjamin Hoopes
647 Points<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" tools:context=".MainActivity" >
<button android:id="@android:id/button1"/>
</RelativeLayout>

Benjamin Hoopes
647 PointsNot sure why the code won't show up in the forum!

James Barnett
39,199 PointsFixed the formatting on your code, make sure to check out the thread that Kevin Korte linked to.

Ben Jakuben
Treehouse TeacherOne letter off! View elements in Android layout XML begin with capital letters. They are class names, essentially. :)

Benjamin Hoopes
647 PointsThank you everyone!