0
I would like to know how to close the layout adview if the user clicks on the ad "X".
My ad code is the below and use in the main layout activity_main:
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 that 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 not successful!
Can someone help me with that question?
I’ll test and you give the result!
– user41630
It worked! Thanks for the help!
– user41630