Hi,
I use the Google Play Services SDK with SMART_BANNER and a webview.
Therefore I created the following xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/rl"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView
android:id="@+id/webView1"
android:layout_above="@+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adUnitId="ca-app-pub-0/0"
ads:adSize="SMART_BANNER"/>
</RelativeLayout>
In the java I used this code:
AdView adView = (AdView)this.findViewById(R.id.adView);
//adView.setAdSize(AdSize.SMART_BANNER);
//adView.setAdUnitId(idbanner);
adView.loadAd(new AdRequest.Builder().build());
I would like to insert the AdUnitId dynamically. But I can't use lines 2 and 3 in the second code because with xml I must provide these information in the xml.
I tried it without defining AdView in xml, only in the code. But then the banner is over the webview. I also tried gravity...
Could you please give me a short help or a code snipped?
Thanks very much!