I would like to know how to close the adview of the layout if the user clicks the "X" of the ad.
My ad code is below and I use it in the main activity_main layout:
MobileAds.initialize(getApplicationContext(), getString(R.string.ID_APP_ADMOB));
AdView mAdView = (AdView) findViewById(R.id.adView);
AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
I use this code.
My xml is the following:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
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="com.xxx.android.MainActivity"
android:padding="0dp"
android:orientation="vertical"
android:weightSum="1"
android:background="#2c3e50">
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview"
android:visibility="invisible"/>
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"
android:indeterminate="false" />
</FrameLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/ID_ANUNCIO_BANNER">
</com.google.android.gms.ads.AdView>
I tried to implement this question: Disable admob ads after a click? ( In English) but I did not succeed!
Can anyone help me with this question?