我有一些问题的布局显示广告从admob。
当应用程序刚刚启动时,没有广告,一切都很好。布局占据了整个屏幕。然后,当应用程序可以加载广告(在顶部)时,整个布局将向下移动,以便显示广告。
如果当有广告时,整个布局不会向下移动,那就更好了,即如何设置代码,以便我可以在横幅位置保留空白背景,以便当没有广告时,它显示空白背景(并且不影响剩余布局),当有广告时,它替换空白背景的位置,其余布局仍然固定在其原始位置?
另外,我想问一下,代码中的ads:refreshInterval="15000“是否意味着在15秒内刷新广告?我测试了一下,广告似乎没有按照规定刷新任何内容?
非常感谢!
代码如下:
<?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" >
...发布于 2012-10-17 01:20:59
在您的AdView中,您可以设置android:layout_height="50dp"以使容器即使在广告不存在时也会占用空间。
ads:refreshInterval不是有效属性,因此将被忽略。刷新率是在AdMob UI中设置的,无法在你的应用代码中更改。
https://stackoverflow.com/questions/12875700
复制相似问题