android – 在actionbarsherlock上方获取admob

android – 在actionbarsherlock上方获取admob,第1张

概述我想在同一个 Android应用程序中使用AdMob和ActionBarSherlock,但我没有设法将AdMob放在我的屏幕顶部(在Sherlock ActionBar之上). 有人有类似的问题吗?有谁知道一些解决方法? 谢谢. 我的总体布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"and 我想在同一个 Android应用程序中使用AdMob和ActionbarSherlock,但我没有设法将AdMob放在我的屏幕顶部(在Sherlock Actionbar之上).

有人有类似的问题吗?有谁知道一些解决方法?

谢谢.

我的总体布局:

<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="fill_parent"androID:layout_height="fill_parent"androID:orIEntation="vertical" > <include layout="@layout/admob"/> <TabHost xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:ID="@androID:ID/tabhost" androID:layout_wIDth="match_parent" androID:layout_height="match_parent"> <linearLayout.....

我的adob布局:

<?xml version="1.0" enCoding="utf-8"?><com.Google.ads.AdVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID"                    xmlns:ads="http://schemas.androID.com/apk/lib/com.Google.ads"                    androID:ID="@+ID/adVIEw"                    androID:layout_height="wrap_content"                    ads:adUnitID="123456"                    ads:adSize="BANNER"                     androID:layout_wIDth="match_parent"/>
解决方法 我正在使用ActionbarSherlock作为包装器,以下内容将广告放在 *** 作栏上方

private ActionbarSherlock sherlock = ActionbarSherlock.wrap(this);@OverrIDepublic voID onCreate(Bundle savedInstanceState){    /* ... set up layout here ... */    adVIEw = new AdVIEw(this,AdSize.BANNER,"deadbeefmeat");    VIEwParent parentVIEw = appVIEw.getParent();    do    {        parentVIEw = parentVIEw.getParent();    } while(!(parentVIEw instanceof linearLayout));    ((linearLayout)parentVIEw).addVIEw(adVIEw,0);    AdRequest adRequest = new AdRequest();    adRequest.addTestDevice(AdRequest.TEST_EMulATOR);    adVIEw.loadAd(adRequest);}// All setContentVIEw methods are overrIDden because ActionbarSherlock has to modify the vIEw@OverrIDepublic voID setContentVIEw(int layoutResID){    // Don't call super!    sherlock.setContentVIEw(layoutResID);}@OverrIDepublic voID setContentVIEw(VIEw vIEw){    // Don't call super!    sherlock.setContentVIEw(vIEw);}@OverrIDepublic voID setContentVIEw(VIEw vIEw,LayoutParams params){    // Don't call super!    sherlock.setContentVIEw(vIEw,params);}
总结

以上是内存溢出为你收集整理的android – 在actionbarsherlock上方获取admob全部内容,希望文章能够帮你解决android – 在actionbarsherlock上方获取admob所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1124625.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存