Make adview stick in place when sliding menu

224 Views Asked by At

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

There are 1 best solutions below

1
On

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 :)