首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Admob和ListActivity

Admob和ListActivity
EN

Stack Overflow用户
提问于 2011-01-30 03:50:28
回答 1查看 849关注 0票数 0

我以前问过这个问题,但没有得到一个“足够好”的答案。

我的问题基本上是我不能让Admob在ListActivity中正确显示。

我的布局如下所示:

代码语言:javascript
复制
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:myapp="http://schemas.android.com/apk/res/se.javalia.myDrinks"
    android:orientation="vertical">
    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
        <ListView android:id="@+id/android:list" android:layout_alignParentTop="true"
            android:layout_width="fill_parent" android:layout_height="wrap_content" />
        <TextView android:id="@+id/android:empty"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:text="@string/main_no_items" />
    </LinearLayout>
    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" >
        <com.admob.android.ads.AdView android:id="@+id/ad"
            android:layout_alignParentBottom="true"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF"
            myapp:secondaryTextColor="#CCCCCC"
            myapp:keywords="drink alcohol wiskey rum soda" myapp:refreshInterval="300" />
    </LinearLayout>
</RelativeLayout>

现在的问题是,如果我将layout_hight更改为fill_parent或尝试一个大于150px的值,广告将不会显示。当layout_hight为150或更低时,它显示得很好。这样做的目的是让列表在广告占据其位置后填满屏幕。

有什么建议吗?我完全不知道如何解决这个问题。

我将更新问题,如果答案没有得到所有的方式,所以请检查更新。

提前感谢罗兰

EN

回答 1

Stack Overflow用户

发布于 2011-01-30 04:45:00

使用一个RelativeLayout作为外层包装,并将列表视图设置为parent top,将adview设置为parent bottom。

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

https://stackoverflow.com/questions/4839051

复制
相关文章

相似问题

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