gpt4 book ai didi

android - AdView 缺少必需的 xml 属性 adSize

转载 作者:行者123 更新时间:2023-11-29 15:28:43 24 4
gpt4 key购买 nike

我试图使用下面的代码显示添加。我收到错误消息“AdView 缺少必需的 xml 属性 adSize”。

问题是什么?

主.xml:

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/com.jms.AdmobExample"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14f1d807e488dd" />
</LinearLayout>

属性.xml:

  <?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.google.ads.AdView">
<attr name="adSize">
<enum name="BANNER" value="1"/>
<enum name="IAB_MRECT" value="2"/>
<enum name="IAB_BANNER" value="3"/>
<enum name="IAB_LEADERBOARD" value="4"/>
</attr>
<attr name="adUnitId" format="string"/>
</declare-styleable>
</resources>

最佳答案

用这个

 <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/com.jms.AdmobExample"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res/com.jms.AdmobExample"
android:id="@+id/add_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ns:adSize="BANNER"
ns:adUnitId="a14f1d807e488dd" >
</com.google.ads.AdView>

</Linearlayout>

关于android - AdView 缺少必需的 xml 属性 adSize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9096764/

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