How to place your ads at the bottom of your screen in Android

So you’ve setup some ads using AdMob or AdWhirl for your android application, and you’re having a hard time getting the ad to appear at the bottom of your screen? Well fear not, for we have a solution.

What you need to do, is to have a RelativeLayout, and within that, have one LinearLayout for your own views, and another LinearLayout which just contains the ads, and anchor that to the bottom of the screen.

Have a look at my example here :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""
    <LinearLayout android:layout_width="fill_parent"
        <!-- Put all your application views here, such as buttons, textviews, edittexts and so on -->

    <LinearLayout android:layout_width="fill_parent"

Hope this helps!

9 replies on “How to place your ads at the bottom of your screen in Android”

Hi James, was wondering if you have any experience of A sync tasks? The app I am developing freezes because there is too much going on sometimes. Have looked online at many examples, but all seem very complex. Your code is usually easier to follow!

Hi Philip, thanks for the comment.

Your app freezes because too much is going on? One of the golden rules I’ve been told from Google is to move any resource hungry/time consuming actions OFF of the main UI thread. For example, if your application goes off to download some data from the net (i.e., a REST call), don’t do that on the main thread otherwise your activity will hang around twiddling its thumbs until that REST call is complete. ASync tasks, or services are ideal for sorting this out. You can then use the runOnUIThread() method to get data back onto the screen.

I have some sample code on my box at home that you press a button on the screen, it fires off a service which does something for 10 seconds on a background thread, and updates a progress bar on the screen, that might help you. I actually have it on my “to do” list this weekend to cover some Async / service related stuff, so if you can let me know your exact requirements I’ll see if I can’t tweak a tutorial for you :)

Have fun!

hey –
tried using your code and i get the ad at the bottom of the screen, but it overlaps my main content instead of resizing it. any way to get around this and get the main content to squeeze up instead of being overlapped? (such as what happens if you place the ad at the top of the screen in a linearlayout)

Hi Emma,

Whats your layout look like? Odd that its overlapping, it should resize the display so that everything fits in OK. Might be worth checking the FILL_PARENT options in the nested layouts.


Hi! great tutorial James!
this has partially answer my question….
i actually want to put my admob at the bottom(just like you have shown above) but, what i want is, when the ads are not available the content above it will fill the rest of the layout. but if there’s any ads, then it will push all the contents up…
in my case the content is list, so when the ads pops, it will resize the listview to give some space for the ads….

do you have any idea how to accomplish this? Thanks!

Hi! i got it works!
just the same problem like Emma had, i add android:layout_above=”@+id/ad_layout to home_layout
and FOILA! it works! thanks for the tutorial…

i also saw your post at

it’s nice! thank you! btw do you have any alternative for another ads provider james? coz i think admob is little bit screw with me…. i mean it’s often replies “no ads are available this time” (i’m wondering if i could be rich with that….) :(

Leave a Reply

Your email address will not be published. Required fields are marked *