Xenon Inc
Xenon Inc

Reputation: 1

My android banner ad not showing?

this my main activity xml code i dont know whats wrong with this please help me anyone?

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

 <com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>

<!-- 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"/>

i added all permissions also in manifest too

Upvotes: 0

Views: 163

Answers (1)

William
William

Reputation: 20196

You are using a FrameLayout as your container and then providing the AdView and ListView as children. But the ListView has been configured with

android:layout_width="240dp" android:layout_height="match_parent" so it will consume all available space.

Use a LinearLayout instead and configure your ListView with android:layout_width="240dp" android:layout_height="0dp" android:layout_weight="1" This will let it fill all remaining vertical space.

Upvotes: 1

Related Questions