滚动网页视图至底部后显示AdMob广告 [英] display admob ad after scrolling webview to the bottom

查看:232
本文介绍了滚动网页视图至底部后显示AdMob广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

反正只有用户滚动网页视图一路底部后显示AdMob广告?我不希望它显示在网页视图之上,因为它会阻止的内容或会降低可见区域。我应该如何修改我的XML?


解决方案

  1. 获取web视图使用内容的高度:

      INT身高=(INT)Math.floor(webView.getContentHeight()* webView.getScale());


  2. 中覆盖的WebView滚动方式来听滚动事件,如果滚动达到真正的高度,Webview是在滚动的底部。呼叫 loadAd()在这里。

Is there anyway to display an admob ad only after the user scrolls the webview all the way to the bottom? I don't want it displaying on top of the webview since it will block the content or it will reduce the visible area. How should I modify my XML?

解决方案

  1. Get webView content height using:

    int height = (int) Math.floor(webView.getContentHeight() * webView.getScale());
    

  2. Override the scroll method in webview to listen to scroll event, if the scroll reach the real height, webview is in the bottom of the scroll. Call loadAd() here.

这篇关于滚动网页视图至底部后显示AdMob广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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