【问题标题】:I can't use adMob in my App我无法在我的应用中使用 adMob
【发布时间】:2015-06-18 13:40:24
【问题描述】:

当我添加代码时

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#F0F8FF"
    android:orientation="vertical" >
<ListView
    android:id="@+id/lvHienThi"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

<com.google.android.gms.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|center"
    ads:adSize="BANNER"
    ads:adUnitId="@string/ad_unit_id" />

它告诉我:“在包'....'中找不到属性'adSize'的资源标识符” 我该如何解决?请帮我。谢谢!

【问题讨论】:

    标签: android admob


    【解决方案1】:

    在您的自定义布局命名空间中将 /res/ 替换为 /lib/

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

    将会

     xmlns:yourApp="http://schemas.android.com/apk/lib/com.yourAppPackege.yourClass"
    

    希望对你有帮助:)

    【讨论】:

    【解决方案2】:

    而不是

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

    添加

    xmlns:ads="http://schemas.android.com/apk/res/your.package.name"
    

    用你的实际包名替换“your.package.name”

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多