hello there today I tried to make a relative layout for android but I m getting errors in R.java: "Unexpected end of declaration" 8 times I passed a hour on it and I still didnt find anything
here is the code (I m sure its about xml not java code)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/playScrollView1">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:id="@+id/playRelativeLayout1">
<TextView
android:layout_height="wrap_content"
android:text="Convert to binary"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="fill_parent"
android:id="@+id/TextView1"
android:layout_alignParentTop="true"/>
<Button
android:layout_height="wrap_content"
android:text="0"
android:layout_width="wrap_content"
android:layout_below="@id/TextView1"
android:id="@+id/1"/>
<Button
android:layout_height="wrap_content"
android:text="0"
android:layout_width="wrap_content"
android:id="@+id/2"
android:layout_below="@id/1"/>
</RelativeLayout>
</ScrollView>
thanks in advance!
You need to use
<Button
android:layout_height="wrap_content"
android:text="0"
android:layout_width="wrap_content"
android:layout_below="@+id/TextView1" // missing+
android:id="@+id/button1"/> // change id to button1 not 1
Same for other button
http://developer.android.com/guide/topics/ui/declaring-layout.html
Any View object may have an integer ID associated with it, to uniquely identify the View within the tree. When the application is compiled, this ID is referenced as an integer, but the ID is typically assigned in the layout XML file as a string, in the id attribute.
Example :
android:id="@+id/my_button"
The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource. The plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in the R.java file)
For relative layout
http://developer.android.com/guide/topics/ui/layout/relative.html
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/playScrollView1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:id="@+id/playRelativeLayout1">
<TextView
android:layout_height="wrap_content"
android:text="Convert to binary"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="fill_parent"
android:id="@+id/TextView1"
android:layout_alignParentTop="true"/>
<Button
android:layout_height="wrap_content"
android:text="0"
android:layout_width="wrap_content"
android:layout_below="@+id/TextView1"
android:id="@+id/button1"/>
<Button
android:layout_height="wrap_content"
android:text="0"
android:layout_width="wrap_content"
android:id="@+id/2"
android:layout_below="@+id/button1"/>
</RelativeLayout>
</ScrollView>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments