首页 > 解决方案 > 框架布局内的 Admob 横幅

问题描述

我试图在 framelayout 中插入 admob 横幅但不起作用,任何人都可以帮我插入它,我尝试了很多方法但我找不到解决方案,对此有什么想法吗?

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.FloatingActionButton
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toggle_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginBottom="16dp"
        android:visibility="gone"
        app:backgroundTint="@color/fab_color"
        app:fabSize="normal" />
        
    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:adUnitId="MY_AD_UNIT_ID"
        ads:adSize="BANNER"/>

</FrameLayout>

标签: androidhtmladmobandroid-framelayout

解决方案


推荐阅读