【问题标题】:Java Eclipse android-XML editor (graphic display) is not workingJava Eclipse android-XML 编辑器(图形显示)不工作
【发布时间】:2014-06-30 16:21:55
【问题描述】:

我正在 Java Eclipse 上开发一些适用于 Android 的应用程序。至于现在一切正常,但今天突然布局图形显示停止工作,无论我尝试创建新布局还是尝试打开现有布局。它显示没有 XML 内容。请为您的文档添加根视图或布局。错误。我尝试按照android sdk main.out.xml parsing error? 的说明进行操作,但我没有 XSL 选项 Eclipse -> 窗口 -> 首选项 -> 运行/调试 -> 启动 -> 启动配置 -> 过滤检查启动配置类型。我也没有任何 .out.xml 文件。

这是我的 XML 和清单文件。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world"
        tools:context=".FirstScreenActivity" />

</RelativeLayout>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="s.manipulator"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".FirstScreenActivity"
            android:label="@string/title_activity_first_screen" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="android.app.LauncherActivity" />
        </activity>
        <activity
            android:name=".MainMenuActivity"
            android:label="@string/title_activity_main_menu" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="s.manipulator.FirstScreenActivity" />
        </activity>
    </application>

</manifest>

【问题讨论】:

    标签: android xml eclipse


    【解决方案1】:

    简单修复:

    布局文件右键->打开方式->Android布局编辑器

    在 Eclipse 中,转到 Window -> Preferences -> General -> Editors -> File Associations 并选择 *.xml,然后在关联编辑器列表中的 Android Layout Editor 条目上按 Default。

    【讨论】:

    • 不幸的是,没有效果。就好像布局编辑器中的这个图形显示工作不正常(当原始 XML 代码中有实际内容时,它没有显示任何竞争)。经过一些进一步的研究herehere,我最终重新安装了 ADT 插件,这解决了问题,但仍然是一个糟糕的解决方案......
    【解决方案2】:

    我最终要做的是从 kumar_android 所指的同一列表中选择 Legacy Android Xml Resources Editor 并将其设置为默认值。我必须从单击添加按钮时出现的列表中选择它。之后我重新启动了eclipse,一切都很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-12
      • 1970-01-01
      • 1970-01-01
      • 2011-10-20
      • 2013-08-07
      • 2011-11-09
      • 2023-04-11
      • 2012-06-17
      相关资源
      最近更新 更多