错误:(1)错误解析XML:没有很好地形成(无效标记) [英] Error:(1) Error parsing XML: not well-formed (invalid token)

查看:197
本文介绍了错误:(1)错误解析XML:没有很好地形成(无效标记)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在右侧点击错误的错误:(1)错误解析XML:没有很好地形成(无效标记),然后转到源它打开以下activity_main.xml中。我不能够计算错误了。

 <的FrameLayout
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s
    机器人:ID =@ + ID /容器
    工具:上下文=com.example.utkarsh.beatle.app.MainActivity
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    工具:忽略=MergeRootFrame/>

Andoridmanifest.xml

 <?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    包=com.example.utkarsh.beatle.app>    <应用
        机器人:allowBackup =真
        机器人:图标=@的mipmap / ic_launcher
        机器人:标签=@字符串/ APP_NAME
        机器人:主题=@风格/ AppTheme>
        <活动
            机器人:名字=。MainActivity
            机器人:标签=@字符串/ APP_NAME>
            &所述;意图滤光器>
                <作用机器人:名字=android.intent.action.MAIN/>                <类机器人:名字=android.intent.category.LAUNCHER/>
            &所述; /意图滤光器>
        < /活性GT;
    < /用途>< /清单>

fragment_main.xml

 <的FrameLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
的xmlns:工具=htt​​p://schemas.android.com/tool​​s
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:paddingLeft =@扪/ activity_horizo​​ntal_margin
机器人:paddingRight =@扪/ activity_horizo​​ntal_margin
机器人:paddingTop =@扪/ activity_vertical_margin
机器人:paddingBottom会=@扪/ activity_vertical_margin
工具:上下文=$ com.example.utkarsh.beatle.app.MainActivity PlaceholderFragment>< ListView控件的android:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:ID =@ + ID / list_view_forecast/>< /&的FrameLayout GT;

activity_main.xml中

 <的FrameLayout
的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
的xmlns:工具=htt​​p://schemas.android.com/tool​​s
机器人:ID =@ + ID /容器
工具:上下文=com.example.utkarsh.beatle.app.MainActivity
机器人:layout_width =match_parent
机器人:layout_height =match_parent
工具:忽略=MergeRootFrame/>

list_item_forecast.xml

 <?XML版本=1.0编码=UTF-8&GT?;
< TextView中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent
安卓了minHeight =机器人:ATTR /列表preferredItemHeight
机器人:重力=center_vertical
机器人:ID =@ + ID / list_item_forecast_textview/>


解决方案

的FrameLayout 更改为 RelativeLayout的 activity_main.xml中解决了这个错误,但我不知道它是如何工作,什么是错的的FrameLayout 。但我被困我的previous问题,我再次得到任何错误消息,但我的应用程序不显示任何的ListView 当我在我的设备上运行它,空白屏幕写在上面的应用程序名称出现在点击我的设备的应用程序图标即可。谁是有同样的问题,请别人帮助我,请检查是否改变为 RelativeLayout的工作或没有。

On right clicking the error "Error:(1) Error parsing XML: not well-formed (invalid token)" and then jump to source it opens the following activity_main.xml. I am not able to figure the error out

<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"/>

解决方案

Changing from FrameLayout to RelativeLayout in activity_main.xml solved the error, but I don't know how it worked and whats wrong in FrameLayout. But I got stuck to my previous problem , again I am getting no error messages but My app doesn't show any ListView when i run it on my device ,blank white screen with app name written on top appears on clicking the app icon in my device. Others who are having the same problem please help me and please check whether changing to RelativeLayout works or not.

这篇关于错误:(1)错误解析XML:没有很好地形成(无效标记)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆