Reputation: 4559
I am displaying a google.ads.AdView
in my app at the bottom of the screen. All works fine. But the only problem is that it doesn't take the full width of the screen while showing in Samsung galaxy note
, however while displaying in Nexus s
it takes the full width of the screen.
Why this happens, is there is a way to solve this issue?
My XML Layout where I put my google.ads.AdView
is:
<LinearLayout
android:id="@+id/bottom_control_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14e5222d46c63d"
ads:loadAdOnCreate="true" >
</com.google.ads.AdView>
</LinearLayout>
Upvotes: 3
Views: 8267
Reputation: 15774
The width of the AdView varies depending on the attribute adSize. You can check the various values for this attribute in https://developers.google.com/mobile-ads-sdk/docs/admob/android/banner#banner_size. You can use the SMART_BANNER
constant in case you are using v6.0.0 or later of AbMob.
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="yourAdUnitId"
ads:adSize="SMART_BANNER"
ads:loadAdOnCreate="true"/>
Upvotes: 21
Reputation: 28152
I have two suggestions. First try setting the width to match_parent. If this isn't possible with addmob then I'd suggest that you center it with layout_gravity="center" so it looks less silly :)
Upvotes: 0