android view 中出现的常见问题,Error parsing XML: unbound prefix [英] frequent issues arising in android view, Error parsing XML: unbound prefix

查看:32
本文介绍了android view 中出现的常见问题,Error parsing XML: unbound prefix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android视图中经常遇到问题,Error parsing XML: Unbound prefix on Line 2.

I have frequent problem in android view, Error parsing XML: unbound prefix on Line 2.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:id="@+id/myScrollLayout" 
android:layout_width="fill_parent"  android:layout_height="wrap_content">
    <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" 
    android:text="Family" android:id="@+id/Family" 
    android:textSize="16px" android:padding="5px" 
    android:textStyle="bold" android:gravity="center_horizontal">
    </TextView>

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:orientation="vertical" android:scrollbars="vertical">
        <LinearLayout android:orientation="vertical" android:id="@+id/myMainLayout" 
        android:layout_width="fill_parent"  android:layout_height="wrap_content">
        </LinearLayout>
    </ScrollView>

</LinearLayout>

推荐答案

发生这种情况的几个原因:

A couple of reasons that this can happen:

1) 您看到此错误,名称空间不正确,或属性中存在拼写错误.比如'xmlns'是错的,应该是xmlns:android

1) You see this error with an incorrect namespace, or a typo in the attribute. Like 'xmlns' is wrong, it should be xmlns:android

2) 第一个节点需要包含:xmlns:android="http://schemas.android.com/apk/res/android"

2) First node needs to contain: xmlns:android="http://schemas.android.com/apk/res/android"

3) 如果您要集成 AdMob,请检查ads:adSize 等自定义参数,您需要

3) If you are integrating AdMob, check custom parameters like ads:adSize, you need

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"

4) 如果您使用 LinearLayout,您可能需要定义工具:

4) If you are using LinearLayout you might have to define tools:

xmlns:tools="http://schemas.android.com/tools"

这篇关于android view 中出现的常见问题,Error parsing XML: unbound prefix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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