2

My main working tool is IntelliJ. So I use it to create XML files and layouts for Android activities. However, if I open such XML file in Eclipse, it does not recognize it as layout file and does not load its GUI designer (I open XML file via Eclipse Layout Editor). If I create an XML file in Eclipse, the GUI designer loads properly.

The very content of Eclipse layout XML filet and IntelliJ layout XML file is 100% identical.

What am I doing wrong?
//////////////////////////////////////////////////////////////
EDIT: I have created new project in IntelliJ. Added some test elements into Main.xml. Exported project to Eclipse format (File->Export to Eclipse...). Closed IntelliJ, opened Eclipse, Imported the newly created project, opened Main.xml with Layout Editor and NOTHING again. This is structure of Main.xml

   <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
        >
    <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Hello World, MyActivity"
            />
    <TextView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="just testing text"/>
    <ImageView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:src="@drawable/icon"/>
    <LinearLayout
            android:layout_height="wrap_content"
            android:layout_width="wrap_content">
        <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="test inside of layout"/>
    </LinearLayout>
</LinearLayout>

And this is how Eclipse Layout Editor sees this XML file.

2
  • yes. the xml file is in that dir Commented Jun 8, 2011 at 21:03
  • I have narrowed the problem and I will open a new question! This one will be close. Commented Jun 11, 2011 at 15:07

4 Answers 4

8

Try this

  1. Right click on that xml file
  2. Select Open With
  3. In that select Android Layout Editor
Sign up to request clarification or add additional context in comments.

2 Comments

It opens it with Layout Editor, but I cannot see any graphical elements. I will edit the question and add some code.
This works for me, however this does not resolve doubleclicking on the file and having it open in the layout editor.
3

Once you copy the file to the res/layout folder, right click on the project in the project explorer and hit refresh to let it know Eclipse the file is there. You might need to clean the project and rebuild also.

An xml file does not depend on where you created, it's just text.

10 Comments

Does not work. Eclipse sees it but opens it with its XML editor.
Well, to start you don't have a closing </RelativeLayout>, so this xml is not readable
I have. This is just a part of XML file. :))
can you post the full layout?
I will add it. It's nothing complicated. Do you work in IntelliJ as well? Do you have problems with Eclipse layout editor?
|
1

Make sure the name given to your xml is just all small letters and underscore, no Caps. I had the same problem and changing the Case worked well

Comments

0

just give it time to generate the view. the bigger your layout file, the longer it takes. what you're seeing is a lack of a progress bar that shows it's doing something. just be patient for a while and it should come up

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.