Android relative layout issue

Arnaud Aliès

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!

Raghunandan

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

android relative layout issue with button

From Dev

Issue with programmatical alignment inside Relative layout in Android

From Dev

Coordinator Layout and Relative Layout issue

From Dev

Layout issue related to "Relative Layout"

From Dev

progressbar on top of Button in relative layout issue in Android Studio

From Dev

Zooming a layout (Relative Layout) in android

From Dev

Zooming a layout (Relative Layout) in android

From Dev

android relative layout design

From Dev

Infalting Relative Layout Android

From Dev

Relative layout android loopable

From Dev

Android Relative Layout

From Dev

Android relative layout positioning

From Dev

Android relative layout center

From Dev

Relative layout android loopable

From Dev

Android Relative Layout position

From Dev

Android: Relative Layout

From Dev

Color issue onFocus/onClick in relative layout

From Dev

Android Relative Layout with sticky footer

From Dev

Android Relative Layout image overlay

From Dev

Android Relative layout "is not a sibling" error

From Dev

Android Relative Layout Padding Issues

From Dev

Android complex layout linear and relative

From Dev

Android - Relative layout inside ScrollView

From Dev

Android Relative Layout alignParentRight and alignParentEnd

From Dev

Alignment of views in relative layout android

From Dev

Relative layout gradient mask android

From Dev

Android layout design : Using LinearLayout and Relative layout

From Dev

Android place Relative Layout below Relative Layout programmatically

From Dev

Android place Relative Layout below Relative Layout programmatically