Android Solution Of AdMob Not Showing In WebView
09-04-2014
While developing android application with AdMob and WebView, you can face with a big problem. This problem is that AdMob may not be seen in the screen because WebView encapsulates all screen. To overcome this problem, you should use a layout which looks like the following layout:
<?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:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/linearLayoutWebView" android:layout_height="match_parent" android:layout_width="wrap_content" android:orientation="vertical"> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fitsSystemWindows="true" android:id="@+id/webMain" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:id="@+id/ad_layout" android:layout_height="wrap_content" android:gravity="bottom" android:layout_alignParentBottom="true" android:layout_alignBottom="@+id/linearLayoutWebView"> <com.google.android.gms.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="ca-app-pub-6976467397777777/4770767543"/> </LinearLayout> </RelativeLayout>