【问题标题】:Android Studio Admob Error Attribute UnknownAndroid Studio Admob 错误属性未知
【发布时间】:2020-10-16 13:03:30
【问题描述】:

我在放置如下所示的广告横幅时遇到错误 The Error Here

抱歉,它说您需要 10 或更多声望才能发布图片。

我的广告 XML 代码如下所示

<com.google.android.gms.ads.AdView
        android:id="@+id/adView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

据说必须放代码: ads:adSize 在那里,但每次我输入ads:adSize 它都会变成红色并变成 错误:属性未知。

我在安装过程中遗漏了什么吗?

我该怎么做才能避免错误发生?

【问题讨论】:

    标签: android android-studio ads


    【解决方案1】:

    你需要像ads:adSize="BANNER"这样的属性

    您可以使用以下代码添加代码:

    final AdView adView = new AdView(getActivity());
    adView.setAdUnitId("YourId");
    adView.setAdSize(AdSize.BANNER);
    

    【讨论】:

    • 是的,我尝试使用它,但它会导致错误“错误:属性未知”我在安装中错过了什么吗?
    猜你喜欢
    • 2015-12-17
    • 1970-01-01
    • 2018-03-31
    • 2021-12-05
    • 2019-03-27
    • 2018-06-30
    • 1970-01-01
    • 2012-09-08
    • 1970-01-01
    相关资源
    最近更新 更多