开发者

Android Layout designer doesn't open XML file created in IntelliJ

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 开发者_Go百科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.

Android Layout designer doesn't open XML file created in IntelliJ


Try this

  1. Right click on that xml file
  2. Select Open With
  3. In that select Android Layout Editor


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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜