&引用;Android SDK错误“;分析XML时出错:格式不正确
我是android SDK新手,遇到这两个错误,请帮助!! -文档中根元素后面的标记必须格式正确 -分析XML时出错:格式不正确&引用;Android SDK错误“;分析XML时出错:格式不正确,android,xml,Android,Xml,我是android SDK新手,遇到这两个错误,请帮助!! -文档中根元素后面的标记必须格式正确 -分析XML时出错:格式不正确 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout><shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:layout_width="match_parent"
android:angle="270"
android:centerColor="#4ccbff"
android:endColor="#24b2eb"
android:startColor="#24b2eb" />
<corners
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:radius="5dp" />
</shape><LinearLayout>
</LinearLayout>
您需要对对象进行排序,以便所有对象都必须封装在一个布局对象中。XML文件必须有一个根元素,以便所有其他视图都能容纳。这意味着无论哪个标签在顶部,在底部之前都不能关闭
在xml文件中,您希望LinearLayout成为根元素。但你(可能是偶然)在打开它之后马上关闭了它
改为这样做:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:layout_width="match_parent"
android:angle="270"
android:centerColor="#4ccbff"
android:endColor="#24b2eb"
android:startColor="#24b2eb" />
<corners
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:radius="5dp" />
</shape>
</LinearLayout>
如果答案有用,不要忘记接受:P