首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓AdMob -对齐/定位广告

问安卓AdMob -对齐/定位广告
EN

Stack Overflow用户
提问于 2011-01-26 03:02:29
回答 2查看 2.8K关注 0票数 0

如何使我的广告显示在屏幕底部?

我试过把重力调到最低,但它仍然不动。

当前页面代码:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent"
 android:background="@color/Background_Color">
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" 
  android:orientation="vertical"
  xmlns:myapp="http://schemas.android.com/apk/res/com.x.x" >
  <TextView android:id="@+id/out_text" 
   android:layout_height="fill_parent"
   android:layout_width="fill_parent"
   android:textSize="30dip" 
   android:textColor="@color/Text_Color" />

  <com.admob.android.ads.AdView
   android:id="@+id/ad"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   myapp:backgroundColor="#000000"
   myapp:primaryTextColor="#FFFFFF"
   myapp:secondaryTextColor="#CCCCCC"
   myapp:refreshInterval="10"
   android:visibility="visible" />
 </LinearLayout>
</ScrollView>

任何帮助都将不胜感激!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-01-26 03:07:24

尝试向TextView添加权重。

代码语言:javascript
复制
 android:layout_weight="1"

这意味着,它将占用父级的任何开放空间。

并将此代码添加到ScrollView中:

代码语言:javascript
复制
android:fillViewport="true"
票数 2
EN

Stack Overflow用户

发布于 2011-01-26 03:07:44

请尝试使用RelativeLayout,并为AdView提供android:layout_alignParentBottom="true"属性。

另外,重力只会影响内容,layout_gravity会影响视图本身。(你可能知道这一点,只要指出它)

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4797696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档