gpt4 book ai didi

android - Adview 错误解析 XML 未绑定(bind)前缀 Android

转载 作者:太空宇宙 更新时间:2023-11-03 11:31:06 24 4
gpt4 key购买 nike

让 AdMob 正常运行让我感到非常难过。我犯了一个又一个错误,并且不止一次地放弃了整个事情。现在我从 XML 中收到一个错误,说它无法正确解析。这是目前的代码。我看过其他答案,但我似乎无法弄清楚出了什么问题。如果有人可以查看我的布局文件并让我知道我做错了什么,我将非常感激。值得一提的是,我使用的代码直接来自 AdMob 网站并适用于我自己的应用程序。

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

android:id="@+id/AdLinearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical" >

<!-- Ad Placeholder -->

<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a15138b1a7adad2"
ads:loadAdOnCreate="true"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" />

<ScrollView
android:id="@+id/BaseScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<LinearLayout
android:id="@+id/baseVerticalLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<LinearLayout
android:id="@+id/LinearLayoutH1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="@string/Sad" />

<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="@string/Happy" />
</LinearLayout>

<SeekBar
android:id="@+id/happinessBarID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="@integer/SliderMax"
android:progress="@integer/SliderDefault" />

<LinearLayout
android:id="@+id/LinearLayoutH2"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="@string/Tired" />

<TextView
android:id="@+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="@string/Awake" />
</LinearLayout>

<SeekBar
android:id="@+id/energyBarID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="@integer/SliderMax"
android:progress="@integer/SliderDefault" />

<LinearLayout
android:id="@+id/LinearLayoutH3"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="@string/Calm" />

<TextView
android:id="@+id/textView6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="@string/Anxious" />
</LinearLayout>

<SeekBar
android:id="@+id/anxietyBarID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="@integer/SliderMax"
android:progress="@integer/SliderDefault" />

<LinearLayout
android:id="@+id/LinearLayoutH4"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="@string/No_Pain" />

<TextView
android:id="@+id/textView8"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="@string/Max_Pain" />
</LinearLayout>

<SeekBar
android:id="@+id/painBarID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="@integer/SliderMax"
android:progress="@integer/SliderDefault" />

<DatePicker
android:id="@+id/datePicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<TimePicker
android:id="@+id/timePicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<EditText
android:id="@+id/noteTextFieldID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/Note_Hint"
android:inputType="textMultiLine"
android:maxLength="@integer/NoteLimit" />

<Button
android:id="@+id/enterButtonID"
android:layout_width="132dp"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="dialogPop"
android:text="@string/EnterButtonText" />
</LinearLayout>
</ScrollView>

最佳答案

改变:

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

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

AdMob 要求您使用其包中定义的属性。为了不必每次都键入该 URL,我们使用 xmlns 声明一个 XML namespace ,就像我们为 android 所做的那样。您在声明前加上了 android 而不是 xmlns,这导致了您的错误。

关于android - Adview 错误解析 XML 未绑定(bind)前缀 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15885847/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com