Search code examples
androidadmobads

How to enable user to close the banner ad?


i have seen this article.Close button for AdMob banner

Recently i have downloaded an app..in that there is X button on top left side of the app to close Ad.How can i implement that feature.

This is how my code looks

<RelativeLayout xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <!-- Header -->

    <TextView
        android:id="@+id/Header"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#0585C2"
        android:textSize="16sp"
        android:textStyle="bold" />

    <!-- Expandable list characteristics -->

    <ExpandableListView
        android:id="@+id/expandable_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:childDivider="@android:color/white"
        android:divider="@android:color/darker_gray"
        android:dividerHeight="2dp"
        android:fadingEdge="none" />

    <com.google.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="a1523adgakdggak"
        ads:loadAdOnCreate="true"
        ads:testDevices="TEST_EMULATOR,022b1ahhddlkahda" />

</RelativeLayout>

--Please help me out


Solution

  • After days of research ,finally figured out that we cant do that in xml and also only some specific ad networks are providing that close(x) feature.Basically i am using ad mob....so for now we cant add X button(or admob is not providing that feature)...Lets hope..in future admob enables us to use that feature..:)...