Reputation: 316
I'm developing some apps for Android on Java Eclipse. As for now everything was ok, but today suddenly the layout graphic display stopped working, no matter if I try to create new layout or try to open existing one. It shows No XML content. Please add a root view or layout to your document. error. I tried to follow android sdk main.out.xml parsing error? instructions, but I have no XSL option in Eclipse -> Window -> Preferences -> Run/Debug -> Launching -> Lauch Configuration -> Filter checked launch configuration types. I also don't have any .out.xml file.
Here's my XML and manifest file.
<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>
Upvotes: 3
Views: 3335
Reputation: 3313
What I had to end up doing was selecting the Legacy Android Xml Resources Editor
from the same list that kumar_android is referring to and setting it as the default. I had to choose it from the list that appears when you click the add button. After that I restarted eclipse and everything was fine.
Upvotes: 0
Reputation: 2263
Easy fix:
Right click on the layout file -> Open With -> Android Layout Editor
In Eclipse, go to Window -> Preferences -> General -> Editors -> File Associations and select *.xml and then press Default on the Android Layout Editor entry in the list of associated editors.
Upvotes: 4