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
MICHAEL JONATHAN437 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" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".SmsGrace" android:id="+id/"> <TextView android:text="Did You Know?" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout>
In the above script, the string : android:id="+id/"> is appearing as red letters in my activity_sms_grace.xml box. Please is the solution to this?
Hey Michael! You can just delete the
android:id="+id/". It is used to set an identifier name for an element so that it can be accessed later through the method
findViewById(), but I don't think you need it in your
RelativeLayout. The reason it's appearing as red is because it's expecting you to specify the id name after the
+id/, like this:
Edit: Actually, looking at the final code for the "Build a Simple Android App", it looks like you will need an id for your RelativeLayout eventually. You'll probably add it later on in the course.
Stone Preston42,016 Points
try giving it an ID: