从推含量高达prevent的AdMob

从推含量高达prevent的AdMob

本文介绍了安卓入门:从推含量高达prevent的AdMob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者所以我承担。我有几个按钮的布局,然后一个AD浏览报在底部。当广告加载时,它推动按钮向上,使它们非常小。反正是有prevent被拉高的内容?

下面是我的code

 < XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:广告=htt​​p://schemas.android.com/apk/lib/com.google.ads
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:背景=@可绘制/ background_hdpi>

    < com.google.ads.AdView
        机器人:ID =@ + ID /广告
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_alignParentBottom =真
        广告:adSize =大旗
        广告:adUnitId =a14fc541226f07b
        广告:loadAdOnCreate =真正的>
    < /com.google.ads.AdView>

    <的LinearLayout
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_above =@ ID /广告
        机器人:方向=垂直
        机器人:weightSum =7.0>

        <按钮
            机器人:ID =@ + ID / basics1
            机器人:layout_width =150.0dip
            机器人:layout_height =0.0dip
            机器人:layout_gravity =center_horizo​​ntal
            机器人:layout_marginBottom =2.0dip
            机器人:layout_marginTop =100.0dip
            机器人:layout_weight =1.0
            机器人:文本=概述
            机器人:TEXTSIZE =16.0sp/>

        <按钮
            机器人:ID =@ + ID / basics2
            机器人:layout_width =150.0dip
            机器人:layout_height =0.0dip
            机器人:layout_gravity =center_horizo​​ntal
            机器人:layout_margin =2.0dip
            机器人:layout_weight =1.0
            机器人:文本=运动
            机器人:TEXTSIZE =16.0sp/>

        <按钮
            机器人:ID =@ + ID / basics3
            机器人:layout_width =150.0dip
            机器人:layout_height =0.0dip
            机器人:layout_gravity =中心
            机器人:layout_margin =2.0dip
            机器人:layout_weight =1.0
            机器人:文本=特种部队
            机器人:文字颜色=#FF000000
            机器人:TEXTSIZE =16.0sp/>

        <按钮
            机器人:ID =@ + ID / basics4
            机器人:layout_width =150.0dip
            机器人:layout_height =0.0dip
            机器人:layout_gravity =center_horizo​​ntal
            机器人:layout_margin =2.0dip
            机器人:layout_weight =1.0
            机器人:文本=植物大战僵尸
            机器人:文字颜色=#FF000000
            机器人:TEXTSIZE =16.0sp/>

        <按钮
            机器人:ID =@ + ID / basics5
            机器人:layout_width =150.0dip
            机器人:layout_height =0.0dip
            机器人:layout_gravity =center_horizo​​ntal
            机器人:layout_margin =2.0dip
            机器人:layout_weight =1.0
            机器人:文本=模式
            机器人:文字颜色=#FF000000
            机器人:TEXTSIZE =16.0sp/>

        <按钮
            机器人:ID =@ + ID / basics6
            机器人:layout_width =150.0dip
            机器人:layout_height =0.0dip
            机器人:layout_gravity =center_horizo​​ntal
            机器人:layout_margin =2.0dip
            机器人:layout_weight =1.0
            机器人:文本=队伍/解锁
            机器人:文字颜色=#FF000000
            机器人:TEXTSIZE =16.0sp/>
    < / LinearLayout中>

< / RelativeLayout的>
 

解决方案

您有几个选项。

  1. 请你的按钮有固定的大小,而不是重量而定。重量让你的按钮占用的可用空间的一小部分。因此,当广告加载,可用空间减少,那么你的按键变小。

  2. 更​​改RelativeLayout的到的FrameLayout,并把广告按钮的LinearLayout后。

  3. 里面滚动型将所有的东西,如:

RelativeLayout的 - >滚动型 - >的LinearLayout(高度:WRAP_CONTENT,宽度:FILL_PARENT) - > AD浏览报+的LinearLayout的按钮

I am a beginner so bear with me. I have a layout with several buttons and then an adview at the bottom. When the ad loads, it pushes the buttons up and makes them very small. Is there anyway to prevent the content from being pushed up?

Here is my code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background_hdpi" >

    <com.google.ads.AdView
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="a14fc541226f07b"
        ads:loadAdOnCreate="true" >
    </com.google.ads.AdView>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/ad"
        android:orientation="vertical"
        android:weightSum="7.0" >

        <Button
            android:id="@+id/basics1"
            android:layout_width="150.0dip"
            android:layout_height="0.0dip"
            android:layout_gravity="center_horizontal"
            android:layout_marginBottom="2.0dip"
            android:layout_marginTop="100.0dip"
            android:layout_weight="1.0"
            android:text="Overview"
            android:textSize="16.0sp" />

        <Button
            android:id="@+id/basics2"
            android:layout_width="150.0dip"
            android:layout_height="0.0dip"
            android:layout_gravity="center_horizontal"
            android:layout_margin="2.0dip"
            android:layout_weight="1.0"
            android:text="Campaign"
            android:textSize="16.0sp" />

        <Button
            android:id="@+id/basics3"
            android:layout_width="150.0dip"
            android:layout_height="0.0dip"
            android:layout_gravity="center"
            android:layout_margin="2.0dip"
            android:layout_weight="1.0"
            android:text="Special Ops"
            android:textColor="#ff000000"
            android:textSize="16.0sp" />

        <Button
            android:id="@+id/basics4"
            android:layout_width="150.0dip"
            android:layout_height="0.0dip"
            android:layout_gravity="center_horizontal"
            android:layout_margin="2.0dip"
            android:layout_weight="1.0"
            android:text="Zombies"
            android:textColor="#ff000000"
            android:textSize="16.0sp" />

        <Button
            android:id="@+id/basics5"
            android:layout_width="150.0dip"
            android:layout_height="0.0dip"
            android:layout_gravity="center_horizontal"
            android:layout_margin="2.0dip"
            android:layout_weight="1.0"
            android:text="Modes"
            android:textColor="#ff000000"
            android:textSize="16.0sp" />

        <Button
            android:id="@+id/basics6"
            android:layout_width="150.0dip"
            android:layout_height="0.0dip"
            android:layout_gravity="center_horizontal"
            android:layout_margin="2.0dip"
            android:layout_weight="1.0"
            android:text="Ranks/Unlocks"
            android:textColor="#ff000000"
            android:textSize="16.0sp" />
    </LinearLayout>

</RelativeLayout>
解决方案

You have a few options.

  1. Make your buttons a fixed size instead of weight dependent. Weights make your Buttons take up a fraction of the space available. So when the ad loads, the space available decreases and then your buttons become smaller.

  2. Change your RelativeLayout into a FrameLayout and put the ads after the button LinearLayout.

  3. Put everything inside ScrollView, ie:

RelativeLayout -> ScrollView -> LinearLayout (height:wrap_content,width:fill_parent) -> AdView + LinearLayout with Buttons

这篇关于安卓入门:从推含量高达prevent的AdMob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 01:31