【问题标题】:How to delete an adview from UI?如何从 UI 中删除广告视图?
【发布时间】:2015-12-16 13:21:09
【问题描述】:

image

我想在我的应用中添加广告。首先,我尝试使用 mopub view (fabric) 来显示我的添加,但最近我使用 AdMob 来显示广告。我已删除所有 mopub 代码,并且 admob 可以正确显示广告。但是有一个 adview(如您在顶部的图片标题中所见)显示在 admob 视图上方。如何删除?

这是我的 activity_main.xml 文件。

<android.support.v4.widget.DrawerLayout 

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

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

android:id="@+id/drawer_layout"

android:layout_width="match_parent"

android:layout_height="match_parent">



<!-- Framelayout to display Fragments -->

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"/>

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id" />
</LinearLayout>

<!-- Listview to display slider menu -->

<ListView
    android:id="@+id/list_slidermenu"
    android:layout_width="270dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@drawable/sidebar_gradient"
    android:choiceMode="singleChoice"
    android:divider="@color/white_60_per_trans"
    android:dividerHeight="0.5dp" />

【问题讨论】:

  • 您确定您发布了正确的布局文件吗?它似乎不适合图像。
  • @H Add view can Hide you are doing to remove this can't possible if you want Hide Add this is simple Add.setvisible(View.Gone);

标签: android android-layout android-fragments android-intent admob


【解决方案1】:

试试这个方法

 <com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    ads:adSize="BANNER"
    android:visibility="gone"
    ads:adUnitId="@string/banner_ad_unit_id" />

以编程方式

adView.setvisibility(View.GONE);
adView.setvisibility(View.ENABLE);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-16
    • 1970-01-01
    • 1970-01-01
    • 2021-10-07
    • 1970-01-01
    • 1970-01-01
    • 2017-10-06
    相关资源
    最近更新 更多