Hey everybody! I recently bought a book on developing for android. I got stuck on the main.xml file code when it gave me a bunch of errors... here's the code

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <SlidingDrawer    
            android:id="@+id/drawer"   
            android:layout_width="320dip"        
            android:layout_height="440dip"       
            android:orientation="vertical"         
            android:handle="@+id/handle"        
            android:content="@+id/content">

            <ImageView    
                android:id="@+id/handle"                            
                android:layout_width="48dip"         
                android:layout_height="48dip"              
                android:src="@drawable/icon"  />

            <AnalogClock 
                android:id="@+id/content"     
                android:background="#D0A0A0"                                    
                android:layout_width="fill_parent"           
                android:layout_height="fill_parent" />     
        </SlidingDrawer>              
    </RelativeLayout>

I get several errors...

  1. Element Type "SlidingDrawer" must be followed by either atribute specifications ">" , or , "/>"

  2. Error parsing XML: not well formed (invalid token)

  3. SlidingDrawer layout or its parent RelativeLayout may be useless

If any of you could point me in the right direction I would appreciate it :D

The XML itself is fine and all well formed if you check it with online validators. Im not aware of the android specifics myself.

Element Type "SlidingDrawer" must be followed by either atribute specifications ">" , or , "/>"

One would guess that 'SlidingDrawer' cant have attributes and that it is expecting either ">" (creating a tag which can have child elements placed within), or "/>" closing the tag?

Error parsing XML: not well formed (invalid token)

Looks fine to me..

What is giving the errors, Ie. what IDE etc? and Does the book provide such XML that should work and if so are there any difference between the two?

Mmm how odd, would be worth getting this post moved to the Mobile Dev forums I think as its more Android related than XML.

This article has been dead for over six months. Start a new discussion instead.