adding admob ad to drawerlayout



I am trying to place an admob ad at the bottom of my main screen which is set as drawer layout. The first time I ran the project on my device the ad appeared right in the middle, but I wanted it to appear at the bottom so I moved the admob code to the bottom of the activity_main.xml and now its just not appearing at all no matter where I place this code and I also get no errors in log-cat, this leads me to believe its a layout issue??


Heres my xml code..



<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://ift.tt/nIICcg"
xmlns:ads="http://ift.tt/GEGVYd"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector"
android:background="@color/list_background"/>

<com.google.android.gms.ads.AdView xmlns:ads="http://ift.tt/GEGVYd"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="*********************"
ads:adSize="SMART_BANNER"/>

</android.support.v4.widget.DrawerLayout>


Heres where i add my AdMob code in MainActivity.java



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

AdMobPoker.track(findViewById(R.id.adView), savedInstanceState);


Thanks in advance for any help on this.


1 comment: