1

I am using ads banner in my app.Its showing correct on xml layout but I run this code on device then its not showing 480*800 resulation device but showing properly in 720*1280 device.

what should I add this code so its support all screen resulations.

please help Thanks in advance.`

code here

             <RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="bottom">

              <com.google.android.gms.ads.AdView
             android:id="@+id/adView"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:layout_centerHorizontal="true"
             android:layout_alignParentBottom="true"
             android:layout_marginLeft="10dp"
             android:layout_marginRight="10dp"
             ads:adSize="BANNER"
             ads:adUnitId="banner_ad_unit_id">
         </com.google.android.gms.ads.AdView>
    </RelativeLayout>`
Vijay Prakash
  • 111
  • 11

2 Answers2

1

remove

android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"

if AdView will not get full width of screen, it will not load.

you can refer this answer

Community
  • 1
  • 1
Ravi
  • 34,851
  • 21
  • 122
  • 183
1

If the width of AdView is less than 320dp, it will not show any ads. You can remove your margin values, or change those values base on screen's width to ensure minimum width.

Rey Pham
  • 605
  • 3
  • 11