Android ad size (smart banners are not always valid)
I have encountered a very annoying AdMob problem and its banner size. The size of smart banner is really a good thing. It can do almost anything for you, related to adjusting the size of advertising, but almost No
There is a table in Google Docs that lists the sizes supported by smartbanner. It supports many sizes, but does not support the horizontal size of ordinary Android phones https://developers.google.com/mobile-ads-sdk/android-legacy/docs/admob/smart-banners
That's what it's like now: Portrait - everything's fine
Landscape - not working
So, is there any way to correctly display horizontal advertising? (this is for ads: adsize = "smart_banner". When I use ads: adsize = "banner", it will be displayed on both, but it is fixed to the size given to you by ads: adsize = "banner", so it is on a larger screen)
XML format
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@color/main_bg_color"
android:id="@+id/rel_bg_home">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
android:layout_centerInParent="true"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"
android:textSize="50sp"
android:id="@+id/uber"
android:shadowColor="#000000"
android:shadowRadius="5"
android:textStyle="bold"
android:textColor="@color/text_color"
android:layout_gravity="center_horizontal"
android:layout_weight="0.20"
android:gravity="center|bottom" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="bottom|center_horizontal"
android:layout_weight="0.30"
android:gravity="bottom">
<Button
android:layout_width="90dp"
android:layout_height="wrap_content"
android:text="Play"
android:id="@+id/play"
android:textColor="@color/text_color"
android:layout_marginBottom="20dp" />
<Button
android:layout_width="90dp"
android:layout_height="wrap_content"
android:text="Help"
android:id="@+id/help"
android:textColor="@color/text_color"
android:layout_below="@+id/play"
android:layout_marginBottom="20dp" />
<Button
android:layout_width="90dp"
android:layout_height="wrap_content"
android:text="score"
android:textColor="@color/text_color"
android:id="@+id/score" />
</LinearLayout>
</LinearLayout>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_action_achievement"
android:layout_alignParentLeft="true"
android:layout_alignBottom="@+id/toggle"
android:layout_alignTop="@+id/toggle"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:id="@+id/highscore"/>
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/toggle"
android:minHeight="10dp"
android:minWidth="10dp"
android:background="@drawable/check"
android:layout_alignParentRight="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:textOn=""
android:textOff=""
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_above="@+id/adView" />
<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="SMART_BANNER"
ads:adUnitId="@string/banner_ad_unit_id1">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
resolvent:
Try removing any margins or padding attributes from the parent view of the XML file
I hope this will help you