Android Layout设计器不会打开在IntelliJ中创建的XML文件

san*_*one 2 eclipse android intellij-idea

我的主要工作工具是IntelliJ.所以我用它来为Android活动创建XML文件和布局.但是,如果我在Eclipse中打开这样的XML文件,它不会将其识别为布局文件,也不会加载其GUI设计器(我通过Eclipse Layout Editor打开XML文件).如果我在Eclipse中创建XML文件,则GUI设计器会正确加载.

Eclipse布局XML文件和IntelliJ布局XML文件的内容是100%完全相同.

我究竟做错了什么?
////////////////////////////////////////////////// ////////////
编辑:我在IntelliJ中创建了新项目.在Main.xml中添加了一些测试元素.将项目导出为Eclipse格式(File-> Export to Eclipse ...).关闭IntelliJ,打开Eclipse,导入新创建的项目,再次使用Layout Editor和NOTHING打开Main.xml.这是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>
Run Code Online (Sandbox Code Playgroud)

这就是Eclipse Layout Editor看到这个XML文件的方式.

Lab*_*lan 8

试试这个

  1. 右键单击该xml文件
  2. 选择 Open With
  3. 在那个选择 Android Layout Editor

  • 它使用Layout Editor打开它,但我看不到任何图形元素.我将编辑问题并添加一些代码. (2认同)