放置AdMob广告列表视图下方 [英] Placing admob ads below a listview
本文介绍了放置AdMob广告列表视图下方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要放置AdMob广告的AdView在屏幕的底部。但广告上的ListView最后一个项目重叠,我无法看到的ListView的最后一个项目非常好。如果我使用的android:layout_below =@ + ID / list_view。这些广告不会加载!
我怎么可以把ListView的只是上面的AdView?
< RelativeLayout的
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:方向=垂直> < ListView控件
机器人:ID =@ + ID / list_view
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:比重=中心
机器人:scrollingCache =假
机器人:animationCache =假
机器人:smoothScrollbar =真
机器人:stretchMode =columnWidth中>
< /&的ListView GT;
< com.google.android.gms.ads.AdView
机器人:ID =@ + ID / AD浏览
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_below =@ + ID / list_view
机器人:layout_alignParentBottom =真
机器人:layout_centerHorizontal =真
广告:adSize时=SMART_BANNER
广告:adUnitId设置=@字符串/ ads_banner>
< /com.google.android.gms.ads.AdView>
< / RelativeLayout的>
解决方案
让XML像
<的RelativeLayout的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT> < com.google.android.gms.ads.AdView
的xmlns:广告=http://schemas.android.com/apk/res-auto
机器人:ID =@ + ID / adViewCardItem
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
广告:adSize时=大旗
广告:adUnitId设置=@字符串/ ads_banner>
< /com.google.android.gms.ads.AdView> < ListView控件
机器人:ID =@ + ID / list_view
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentTop =真
机器人:animationCache =假
机器人:比重=中心
机器人:scrollingCache =假
机器人:smoothScrollbar =真
机器人:layout_above =@ + ID / adViewCardItem
机器人:stretchMode =columnWidth中>
< /&的ListView GT; < / RelativeLayout的>
I want to place an adMob AdView at the bottom of the screen. But the ads overlap on the ListView last item and I can't see the last item of the ListView very well. If i use android:layout_below="@+id/list_view". The ads doesn't load!
How can I place the ListView just above the AdView?
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView
android:id="@+id/list_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:scrollingCache="false"
android:animationCache="false"
android:smoothScrollbar="true"
android:stretchMode="columnWidth">
</ListView>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/list_view"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/ads_banner">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
解决方案
Make your xml like
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adViewCardItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/ads_banner">
</com.google.android.gms.ads.AdView>
<ListView
android:id="@+id/list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:animationCache="false"
android:gravity="center"
android:scrollingCache="false"
android:smoothScrollbar="true"
android:layout_above="@+id/adViewCardItem"
android:stretchMode="columnWidth" >
</ListView>
</RelativeLayout>
这篇关于放置AdMob广告列表视图下方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文