i have some troubles on layout on displaying ads from admob.
When the app is justed started there is no ad, everything is fine. the layout occupies the whole screen.
then when the app can load the ad (at the top), the whole layout will shift down so as to display the ad.
it would be much better if the whole layout will not shift down when have ad, i.e. how to set codes such that i can reserve a blank background at the banner place, such that when there is no ad, it show the blank backgorund (and not affecting the remaining layout) and when there is ad, it replace the location of the blank background and the remaining layout still fix at its original place?
Also, i would like to ask whether in the code ads:refreshInterval=”15000″ means refreshing the ad in 15 sec? i test and it seems that the ad does not refresh any as specified?
Many thanks!!
Codes as follows:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*"
android:background="@color/light_green"
android:orientation="vertical"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="123123123"
ads:adSize="BANNER"
ads:refreshInterval="15000"
ads:loadAdOnCreate="true"/>
<TableRow
android:id="@+id/tableRow0"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="8dp" >
...
In your AdView, you can set
android:layout_height="50dp"to make the container take up space even when the ad is not present.ads:refreshIntervalis not a valid property, so it is ignored. The refresh rate is set in the AdMob UI and can’t be changed in your app code.