0

After adding scrollview to my xml file i am getting error at 4th line. I have tried moving xmlns:android="http://schemas.android.com/apk/res/android" but still getting the same error.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.easy.convert.MainActivity" >

<ImageButton
    android:id="@+id/btnbitsbytes"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="25dp"
    android:background="#00000000"
    android:gravity="center"
    android:src="@drawable/btnbitsbytes" />

<ImageButton
    android:id="@+id/btnmassweight"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/btnbitsbytes"
    android:layout_below="@+id/btnbitsbytes"
    android:layout_marginTop="14dp"
    android:background="#00000000"
    android:src="@drawable/btnmassweight" />

<ImageButton
    android:id="@+id/ButtonConvert"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/btnmassweight"
    android:layout_below="@+id/btnmassweight"
    android:layout_marginTop="14dp"
    android:background="#00000000"
    android:src="@drawable/btnlength" />

<ImageButton
    android:id="@+id/imageButton3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/ButtonConvert"
    android:layout_below="@+id/ButtonConvert"
    android:layout_marginTop="14dp"
    android:background="#00000000"
    android:src="@drawable/btntemperature" />

<ImageButton
    android:id="@+id/imageButton4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/imageButton3"
    android:layout_below="@+id/imageButton3"
    android:layout_marginTop="15dp"
    android:background="#00000000"
    android:src="@drawable/btndistance" />

<ImageButton
    android:id="@+id/imageButton5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageButton4"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="22dp"
    android:background="#00000000"
    android:src="@drawable/btnaboutus" />

</RelativeLayout>
</ScrollView>
3
  • 1
    delete the xmlns line from your RelativeLayout and try. Commented Mar 22, 2014 at 18:35
  • 1
    Duplicate xmlns:android is an error but it would produce another error message. If removing it doesn't help, consider posting more of your XML. Commented Mar 22, 2014 at 18:35
  • this doesn't solve the problem, but it's another observation: "fill_parent" is deprecated since API Level 8 (included). Use "match_parent", instead Commented Mar 22, 2014 at 18:40

2 Answers 2

1

Remove xmlns:android="http://schemas.android.com/apk/res/android" for RelativeLayout. That is need only for the root element ie ScrollView

<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>

Remove this

tools:context="com.easy.convert.MainActivity"

or add xmlns:tools="http://schemas.android.com/tools"

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:id="@+id/ScrollView01"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent" 
 tools:context="com.easy.convert.MainActivity">

Edit:

xmlns:android="http://schemas.android.com/apk/res/android

is the xml name space for android.

 xmlns:tools="http://schemas.android.com/tools"

http://schemas.android.com/tools is the namespace uri and the prefix is tools. You can find a list of tools attribute @

http://tools.android.com/tech-docs/tools-attributes

Sign up to request clarification or add additional context in comments.

5 Comments

@Tanmay post the entire xml
@Tanmay Remove this tools:context="com.easy.convert.MainActivity"
Instead of removing this line i have added xmlns:tools="schemas.android.com/tools" line. Can you tell me what is the use of tools:context ?
@Tanmay you could do that
Thanks a lot Raghunandan ! :)
0

You have the tools:context="com.easy.convert.MainActivity" attribute. You need to declare the tools namespace prefix as well, like android is declared:

xmlns:tools="http://schemas.android.com/tools"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.