• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps main.xml problems using "SlidingDrawer"

Yes or no?

  • Yes

    Votes: 1 100.0%
  • No

    Votes: 0 0.0%
  • Yes

    Votes: 0 0.0%
  • No

    Votes: 0 0.0%

  • Total voters
    1
  • Poll closed .

cenchrus

Lurker
Jul 11, 2012
7
0
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

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...

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

Error parsing XML: not well formed (invalid token)

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
 
Hey Javasirc! Thanks for responding! The asterisks aren't in my original code... im not sure why they show up here when I paste my code...

I'm copying this code straight from a book... shouldnt the "</SlidingDrawer>" close the SlidingDrawer tag ???? I tried doing it ur way, and it still didn't work...
 
Upvote 0
I went through the code step by step.

everything is fine with this code...

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



></SlidingDrawer>

But when I change it to this...

<SlidingDrawer ***
android:id="@+id/drawer" **
******* android:layout_width="320dip" *******
** **android:layout_height="440dip" ******
*** **android:eek:rientation="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>

It gives me those errors... so. idk if that helps
 
Upvote 0
After an hour of frustration trying to get this to work:
Revert back to your original code. I was wrong about closing the <SlidingDrawer>.

You need to go into the folder /res/layout/ and delete main.out.xml.

You need to run your project manually, not by using Run (or Ctrl + F11). Im trying to figure out how to make it run my main project by default but im having no luck.


Sorry for the incorrect solution from my first post, and please let me know if this works =)
 
Upvote 0
You dont delete the folder, you delete main.out.xml. Not main.xml. I dont know why the project wont run while this file exists.

To run your project manually, go to Run, then Run Configurations. Under "Android Application", select your project. Then click Run. Make sure you have your emulator select in the Target tab.

Once youve done this, your project should appear in the Run History, you can run it from Run/Run History from then on.
 
Upvote 0
Ive never seen the interface of mac, but its a "main.out.xml" in a folder called layout.

In your Package Explorer (which should be the window on the left side of Eclipse interface), open "res" folder, then "layout" folder. "main.xml" and "main.out.xml" should be in there. If it isnt then dont worry about it, just run your project from Run/Run Configuration.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones