Set admob banner at the bottom of the screen/view?
NickName:H. Tiwari Ask DateTime:2015-12-09T20:04:10

Set admob banner at the bottom of the screen/view?

I'm trying to set an AdMob Banner for my app. In my Activity I've got a ListView, so I need to put the Banner on the bottom of it. The admob banner appears in the middle of the screen. How to fix it in the bottom of the screen? Here is the code:

<!-- Framelayout to display Fragments -->

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<!-- Listview to display slider menu -->

<ListView
    android:id="@+id/list_slidermenu"
    android:layout_width="270dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@drawable/sidebar_gradient"
    android:choiceMode="singleChoice"
    android:divider="@color/white_60_per_trans"
    android:dividerHeight="0.5dp" />

<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>

Copyright Notice:Content Author:「H. Tiwari」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34178398/set-admob-banner-at-the-bottom-of-the-screen-view

Answers
diogojme 2015-12-09T12:30:47

Seems the problem is because your code is not inside a RelativeLayout container, and the attribute android:layout_alignParentBottom=\"true\" will not work correctly, this code will work for you:\n\n<RelativeLayout \n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n xmlns:ads=\"http://schemas.android.com/apk/res-auto\">\n\n\n <!-- Framelayout to display Fragments -->\n\n <FrameLayout\n android:id=\"@+id/frame_container\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\" />\n\n <!-- Listview to display slider menu -->\n\n <ListView\n android:id=\"@+id/list_slidermenu\"\n android:layout_width=\"270dp\"\n android:layout_height=\"match_parent\"\n android:layout_gravity=\"start\"\n android:background=\"@drawable/sidebar_gradient\"\n android:choiceMode=\"singleChoice\"\n android:divider=\"@color/white_60_per_trans\"\n android:dividerHeight=\"0.5dp\" />\n\n <com.google.android.gms.ads.AdView\n android:id=\"@+id/adView\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_centerHorizontal=\"true\"\n android:layout_alignParentBottom=\"true\"\n ads:adSize=\"BANNER\"\n ads:adUnitId=\"@string/banner_ad_unit_id\">\n </com.google.android.gms.ads.AdView>\n</RelativeLayout>\n",


More about “Set admob banner at the bottom of the screen/view?” related questions

Set admob banner at the bottom of the screen/view?

I'm trying to set an AdMob Banner for my app. In my Activity I've got a ListView, so I need to put the Banner on the bottom of it. The admob banner appears in the middle of the screen. How to fix i...

Show Detail

Set Admob banner to appear at bottom of screen

I am currently using this code to display an Admob request; If I use this code, the banner appears, but at the top of the screen not the bottom; CGRect screenRect = [[UIScreen mainScreen] bounds]...

Show Detail

AdMob Banner Covers Bottom Toolbar

I have just loaded an AdMob test banner to my ViewController. I dragged in a View at storyboard level and set it to be the AdMob banner (and I fixed it's size to : 320x50). But it covers my bottom

Show Detail

How to place admob banner at bottom of screen in iOS retina and non retina

I've built a phonegap app and want to add an Admob banner to it. I have the banner working at the bottom of the screen in iOS6 simulator but when I test it on a retina device the banner will be way...

Show Detail

Admob Banner at the top of the screen

I want to have the Admob banner at the top of the screen instead of the bottom. This is what i copied from the Admob Documentations. func addBannerViewToView(_ bannerView: GADBannerView) {

Show Detail

Is it OK to place AdMob banner under bottom app navigation buttons in full screen on Android?

I want to display the AdMob bottom banner as close to the screen's bottom as possible. My app is displayed in full screen mode, so the bottom app navigation buttons are not visible by default. Howe...

Show Detail

Position smart (dynamic) Admob banner to bottom of iOS screen?

I'm creating a smart (dynamic) Admob banner like this bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait origin:CGPointMake(0,0)]; But how do I get it so a smart adMob

Show Detail

How to put admob banner to bottom of the screen using CoordinatorLayout

I use CoordinatorLayout to make sliding tabs in activity_main.xml file. I want to put admob banner to bottom of the screen. But I have a problem, When I try to code below(activity_main.xml) Admob b...

Show Detail

Displaying AdMob banner at bottom of screen

My AdMob banner displays on top of the screen instead of displaying at the bottom. This is my code: adView = new AdView(mSingleton); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId("ca...

Show Detail

Pinning a Google Admob Banner to the bottom of an iPhone X

I have a Google Admob banner (created in code) on the bottom of the main screen in an old project. It works perfect on all devices, except the iPhone X in the Xcode 9 Simulator. The banner is pinne...

Show Detail