Android ビューで頻繁に問題が発生します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
これが起こる理由はいくつかあります:
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"