Android보기에서 자주 발생하는 문제, XML 구문 분석 오류 : 바인딩되지 않은 접두사

안드로이드보기에서 자주 문제가 발생 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>



답변

이것이 발생할 수있는 몇 가지 이유 :

1) 잘못된 네임 스페이스 또는 속성에 오타가있는이 오류가 표시됩니다. ‘xmlns’가 잘못 되었 듯이xmlns:android

2) 첫 번째 노드에는 다음이 포함되어야합니다.
xmlns:android="http://schemas.android.com/apk/res/android"

3) AdMob을 통합하는 경우와 같은 맞춤 매개 변수를 확인 ads:adSize해야합니다.

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

4) 사용중인 경우 LinearLayout도구를 정의해야 할 수 있습니다.

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


답변

여기에 표시되지 않기 때문에 별도의 답변을 추가하겠습니다. Pentium10이 요청한 것은 100 %가 아니지만 검색을 통해 여기서 끝났습니다.Error parsing XML: unbound prefix

와 같은 AdMob 광고에 맞춤 매개 변수를 사용 ads:adSize하고 있지만 추가하지 않은 것으로 나타났습니다.

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

레이아웃에. 내가 추가하면 훌륭하게 작동했습니다.


답변

나는이 같은 문제가 있었다.

접두사 (android : [whatever])의 철자가 올바른지, 올바르게 작성했는지 확인하십시오. 줄의 경우 xmlns:android="http://schemas.android.com/apk/res/android"
전체 접두어가 xmlns:android있고 철자가 올바른지 확인하십시오 . 다른 접두사와 동일-철자가 올바른지 확인하십시오 android:[name]. 이것이 내 문제를 해결 한 것입니다.


답변

언급했듯이 올바른 네임 스페이스 를 지정해야 합니다 . 네임 스페이스가 잘못된이 오류도 표시됩니다.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns="http://schemas.android.com/apk/res/android"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:padding="10dip">

작동 안 할 것이다.

변화:

xmlns="http://schemas.android.com/apk/res/android"

xmlns:android="http://schemas.android.com/apk/res/android"

XML은 ” android:“네임 스페이스가 무엇인지 알지 못하므로 오류 메시지는 “android :”로 시작하는 모든 것을 나타 냅니다.

xmlns:android 그것을 정의합니다.


답변

이 오류는 다음과 같이 정의되지 않은 접두사를 사용하는 경우에 발생할 수 있습니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TabHost
    XYZ:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >


</TabHost>

Android 컴파일러는 아직 정의되지 않았으므로 XYZ가 무엇인지 알지 못합니다.

귀하의 경우 아래 정의를 xml 파일의 루트 노드에 추가해야합니다.

xmlns:android="http://schemas.android.com/apk/res/android"


답변

에 대한 언 바운드 접두사 오류 ViewPager 표시기에 :

parentLayout에 다음 헤더 태그와 함께 :

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

또한 다음을 추가하십시오.

xmlns:app="http://schemas.android.com/apk/res-auto"

이것은 나를 위해 속임수를했다.


답변

나를 위해, 나는 네 번째 줄에서 안드로이드 철자를 잘못 입력했지만 여기에 첫 번째 줄에 “언 바운드 접두사”오류가 발생했습니다.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
anrdoid:fillViewport="true"
>