Home > Net >  Anchored adaptive banners in LinearLayout structure
Anchored adaptive banners in LinearLayout structure

Time:06-27

Good afternoon!

I am updating the normal(smart) admob banners for admob Anchored adaptive banners, I am following the example of google but I have several doubts.

I use LinearLayout as a general structure and not RelativeLayout like the google example.

When using the code to display the banner, it underlines two lines.

Example new code banner admob:

<FrameLayout
    android:id="@ id/ad_view_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_alignParentBottom="true" />

Yellow underline in android studios (in my code):

android:layout_centerInParent="true"

Message or warning: Invalid layout param in a LinearLayout: layout_centerInParent

android:layout_alignParentBottom="true"

Message or warning: Invalid layout param in a LinearLayout: layout_alignParentBottom

Example complet code banner google-admob: https://github.com/googleads/googleads-mobile-android-examples/blob/master/java/admob/AdaptiveBannerExample/app/src/main/res/layout/activity_my.xml

In the application the test ads are displayed well and work. But I don't like the messages of the underlined code (to avoid problems)


Before I used this code for my SMART banners:

<LinearLayout 
        android:id="@ id/ad_view_container"
        android:orientation="vertical"
        android:gravity="bottom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </LinearLayout>

Could I use the same code for Anchored adaptive banners? or does it have to be FrameLayout..?

thank you for answers

CodePudding user response:

Try This

android:layout_gravity="center_horizontal|bottom"
  • Related