Make adview stick in place when sliding menu

感情迁移 提交于 2019-12-13 06:21:56

问题


I have integrated admob ads in my android application. I'm using jfeinstein's sliding menu, so when I slide it, adview slides with it too. How can I make it stick on the screen, no matter of sliding menu state?

Some code:

<com.google.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:id="@+id/adview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="ID"
    ads:loadAdOnCreate="true" />

adView = (AdView) findViewById(R.id.adview);
adView.loadAd(new AdRequest());

回答1:


Try aligning the advert to the left and right of your layout instead of setting width to fill parent. (It will fill the bottom of the page like you want and stop it from sliding around with the sliding menu).

I've done this so I know it works by the way :)



来源:https://stackoverflow.com/questions/21167979/make-adview-stick-in-place-when-sliding-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!