使用Android版式上的WebView将AdView(AdMob)对准屏幕底部 [英] Align AdView (AdMob) to bottom of screen with WebView on Android Layout

查看:156
本文介绍了使用Android版式上的WebView将AdView(AdMob)对准屏幕底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序的默认屏幕显示一个ListView.当用户选择一个条目时,将显示一个带有标题(TextView)的新活动,以及从xml(WebView)获取的一些信息.

The default screen of my app shows a ListView. When the user selects an entry a new Activity is displayed with a Title (TextView), some information gained from xml (WebView).

我想将广告与第二个活动的底部对齐.

I want to place an Ad aligned to the bottom of this second Activity.

我的布局目前是这样:

<LinearLayout android:id="@+id/info" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" style="@style/info">    
    <TextView android:id="@+id/title" style="@style/title" />
    <WebView android:id="@+id/info" style="@style/info" />
</LinearLayout>

这很好用,但是我无法使广告始终位于底部.

This works perfectly, but I can't get the Ad to always be at the bottom.

我已经尝试过RelativeLayout,但是无论如何,我总是得到相同的结果!

I've tried RelativeLayout, but no matter what, I always get the same results!

如果WebView中显示的HTML足够短以至于无法显示AdView(但在WebView的底部而不是底部),或者它太长而根本不显示AdView!

If the HTML shown in the WebView is short enough for the AdView to be displayed (but not at bottom, underneath WebView) or its too long and the AdView is not shown at all!

即使WebView滚动,我也希望AdView始终始终可见!

I want the AdView always visible always, even if the WebView scrolls!

希望这很有道理!

尼尔

PS:如果找到一个答案,我将继续寻找答案并进行更新.

PS: I'll continue to look for answers and update if I find one....

推荐答案

想出了一种解决方法,但这是最好的方法吗?

Figured out a way to solve this, but is it the best way??

这是我的方法:

<LinearLayout android:id="@+id/linearlayout" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:neildeadman="http://schemas.android.com/apk/res/com.neildeadman.android" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" style="@style/Info">
    <LinearLayout android:id="@+id/info" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" style="@style/info">
        <TextView android:id="@+id/title" style="@style/title" />
        <WebView android:id="@+id/info" style="@style/info" />
    </LinearLayout>
</LinearLayout>

"layout_weight"属性使我能够强制内部LinearLayout填充添加项留下的剩余间隙,然后从上方包含我的布局!

The "layout_weight" attributes allowed me to force the inner LinearLayout to fill the remaining gap left by the add, which then contained my layout from above!

做工可爱....

这篇关于使用Android版式上的WebView将AdView(AdMob)对准屏幕底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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