AdMob广告|底部智能横幅广告吗? [英] adMob | Smart banner at bottom?

查看:361
本文介绍了AdMob广告|底部智能横幅广告吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的想法是把AdMob的横幅我试着用 Android的屏幕的底部:layout_alignParentBottom =真正的,但旗帜站在这个地方的中间它占用。目前看起来是这样的: PIC1 我想是这样的:<一HREF =htt​​p://puu.sh/bSp9g/2366510a3e.png相对=nofollow标题=图片> PIC2

我的code:

 &LT; RelativeLayout的的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:广告=htt​​p://schemas.android.com/apk/res-auto
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:背景=@颜色/背景
    机器人:方向=垂直
    工具:上下文=eu.gabrielatanasov.demoViewer.Home_activity&GT;

&LT;的LinearLayout
        机器人:ID =@ + ID / homeContentLayout
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直
        机器人:paddingBottom会=@扪/ activity_vertical_margin
        机器人:以下属性来=@扪/ activity_horizo​​ntal_margin
        机器人:paddingRight =@扪/ activity_horizo​​ntal_margin
        机器人:paddingTop =@扪/ activity_vertical_margin&GT;
 

在这里应用的东西

 &LT; / LinearLayout中&GT;
&LT; com.google.android.gms.ads.AdView
    机器人:ID =@ + ID / AD浏览报
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =match_parent
    机器人:layout_alignParentBottom =真
    机器人:layout_below =@ ID / homeContentLayout
    广告:adSize =SMART_BANNER
    广告:adUnitId =@字符串/ adMob_ID&GT;
&LT; /com.google.android.gms.ads.AdView>

&LT; / RelativeLayout的&GT;
 

解决方案

我修改你的布局一点点,检查了这一点:     

 &LT; RelativeLayout的
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=横向&GT;
    &LT;的LinearLayout
            机器人:ID =@ + ID / homeContentLayout
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT
            机器人:方向=垂直
            机器人:layout_above =@ + ID / AD浏览报&GT;
    &LT; / LinearLayout中&GT;
    &LT; com.google.android.gms.ads.AdView
            机器人:ID =@ + ID / AD浏览报
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_alignParentBottom =真
            机器人:layout_alignWithParentIfMissing =真
            广告:adSize =SMART_BANNER
            广告:adUnitId =admobid&GT;
    &LT; /com.google.android.gms.ads.AdView>

&LT; / RelativeLayout的&GT;
 

The idea is to put the admob banner at the bottom of the screen I tried with android:layout_alignParentBottom = "true" but the banner stand in the middle of the place that it occupies. Currently looks like this: pic1 And I want to look like this: pic2

My code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"
    android:orientation="vertical"
    tools:context="eu.gabrielatanasov.demoViewer.Home_activity" >

<LinearLayout
        android:id="@+id/homeContentLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin" >

App stuff here

</LinearLayout>
<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_below="@id/homeContentLayout"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="@string/adMob_ID" >
</com.google.android.gms.ads.AdView>

</RelativeLayout>

解决方案

I modified your layout a little bit, check this out:

<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
    <LinearLayout
            android:id="@+id/homeContentLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_above="@+id/adView">
    </LinearLayout>
    <com.google.android.gms.ads.AdView
            android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignWithParentIfMissing="true"
            ads:adSize="SMART_BANNER"
            ads:adUnitId="admobid">
    </com.google.android.gms.ads.AdView>

</RelativeLayout>

这篇关于AdMob广告|底部智能横幅广告吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆