Error:(1) Error parsing XML: not well-formed (invalid token)
Error:(1) Error parsing XML: not well-formed (invalid token)
右键单击错误 "Error:(1) Error parsing XML: not well-formed (invalid token)",然后跳转到源代码,它会打开以下 activity_main.xml。我无法找出错误
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
tools:context="com.example.utkarsh.beatle.app.MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MergeRootFrame"/>
Andoridmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.utkarsh.beatle.app" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
fragment_main.xml
<FrameLayout 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"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.utkarsh.beatle.app.MainActivity$PlaceholderFragment">
<ListView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/list_view_forecast" />
</FrameLayout>
activity_main.xml
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
tools:context="com.example.utkarsh.beatle.app.MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MergeRootFrame"/>
list_item_forecast.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:id="@+id/list_item_forecast_textview"/>
在activity_main.xml中从FrameLayout更改为RelativeLayout解决了错误,但我不知道它是如何工作的,也不知道 FrameLayout 有什么问题。但是我遇到了之前的问题,我再次没有收到任何错误消息,但是当我 运行 在我的设备上 我的应用程序没有显示任何 ListView ,单击我设备中的应用程序图标时出现顶部写有应用程序名称的空白屏幕。其他遇到同样问题的人请帮助我,请检查更改为 RelativeLayout 是否有效。
右键单击错误 "Error:(1) Error parsing XML: not well-formed (invalid token)",然后跳转到源代码,它会打开以下 activity_main.xml。我无法找出错误
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
tools:context="com.example.utkarsh.beatle.app.MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MergeRootFrame"/>
Andoridmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.utkarsh.beatle.app" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
fragment_main.xml
<FrameLayout 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"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.utkarsh.beatle.app.MainActivity$PlaceholderFragment">
<ListView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/list_view_forecast" />
</FrameLayout>
activity_main.xml
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
tools:context="com.example.utkarsh.beatle.app.MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MergeRootFrame"/>
list_item_forecast.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:id="@+id/list_item_forecast_textview"/>
在activity_main.xml中从FrameLayout更改为RelativeLayout解决了错误,但我不知道它是如何工作的,也不知道 FrameLayout 有什么问题。但是我遇到了之前的问题,我再次没有收到任何错误消息,但是当我 运行 在我的设备上 我的应用程序没有显示任何 ListView ,单击我设备中的应用程序图标时出现顶部写有应用程序名称的空白屏幕。其他遇到同样问题的人请帮助我,请检查更改为 RelativeLayout 是否有效。