What is wrong with this layout

by idev » Wed, 04 Mar 2009 23:50:36 GMT

Sponsored Links
 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
    android:text="@string/hello" >
    <Button android:id="@+id/installRing"


I cannot understand what is wrong with this layout. I keep getting
this error in the xml saying Element type "Button" must be either
followed by attributes or > or />
I don't understand why the editor can't recognize android:id as an
attribute! I tried writing the whole XML again but keep getting this

Thanks for any help.


What is wrong with this layout

by Stoyan Damov » Thu, 05 Mar 2009 00:40:41 GMT

 Not quite sure (haven't looked at the schema) but perhaps Button is an
empty element, so in your layout it should look like this:

That is, close the element " />" and remove the "</Button>" element end.



Sponsored Links

What is wrong with this layout

by Streets Of Boston » Thu, 05 Mar 2009 06:01:31 GMT

 The XML in your post is ok. I just pasted it into an XML editor and it
validates OK.

However, this is what i've seen in Eclipse as well when editing XML
files for my android projects, especially XML files for layout in
Eclipse's layout-editor plugin for Android.

Sometimes an error is reported when there is none. And most of the
time i could get rid of the error by removing whitespace and re-adding
it; e.g. by deleting a new-line and replacing it by a space. It has me
puzzled... i suspect there is something going on with the white-space
handling of the layout-plugin that handles XML files. Maybe Cr+Lf
versus just Lf, i don't know....


What is wrong with this layout

by iDeveloper » Thu, 05 Mar 2009 11:46:41 GMT


But AFAIK having a close button tag and closing the tag using /> is  
one and the same!


What is wrong with this layout

by Streets Of Boston » Fri, 06 Mar 2009 06:35:15 GMT

 Yep, but not quite: :=)


is the same as


But <button/> is not the same as


because here the button-element has child text-node containing

But then again, in your layout-xml it should not matter. This
whitespace should just be ignored.


What is wrong with this layout

by Marco Nelissen » Fri, 06 Mar 2009 06:40:56 GMT

 That layout compiles fine for me. Are you sure you don't have some
non-printable character in your xml file that is messing things up?


What is wrong with this layout

by iDeveloper » Fri, 06 Mar 2009 12:43:36 GMT

 Yeah that was it. COpied it into notepad and it showed some garbled up  
things. Thanks.


Other Threads

1. ANDROID Home Screen problem on SMDK2440 Platform

HI all,
The above problem has been solved. I enabled the Power management in
the kernel and the above problem is solved.
But there is another problem now.
My Touch screen is taking MIRROR INPUT. i.e when i tap on the icon
which is at the bottom, the icon present at the top gets open.

What is the solution for the MIRROR INPUT?

Thank you
Vinay R Rao

unsubscribe: android-porting+unsubscr...@googlegroups.com

2. restart the phone to view the captured images in gallary


If it's urgent, then you probably should be hiring a consultant. Support
on these lists is on a volunteer basis and does not necessarily fit an
"urgent" timetable.

Here is one possible solution to your issue:

3. G1 ManageApplications - the size of the application data does not change when ...

4. Adding Turn by Turn directions to google maps

5. Strange MP3 Problem - Streaming MediaPlayer

6. Keyboard support: kcm files and map files

7. Adding Turn by Turn directions to google maps