Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Banner bottom Android

How can i set banner on bottom of the screen ?
I tried with RelativeLayout and it stay bottom, but outside screen.

That's my simple code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/layout_home"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="@drawable/background" 
   android:orientation="vertical">

       <LinearLayout 
            android:id="@+id/layout_body"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/background2" 
            android:orientation="vertical">

          ......
       </LinearLayout>
       <RelativeLayout
            android:id="@+id/layout_banner"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
         ....
       </RelativeLayout>
</LinearLayout>

UPDATE

I have set android:layout_alignParentBottom="true" but not change

like image 951
enfix Avatar asked Jul 21 '26 04:07

enfix


2 Answers

Use below XMl Code for Display Banner in Bottom Part.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/layout_home"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="@drawable/background">

       <LinearLayout 
            android:id="@+id/layout_body"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/background2" 
            android:orientation="vertical" 
            android:layout_above="@+id/layout_banner">

          ......
       </LinearLayout>
       <RelativeLayout
            android:id="@+id/layout_banner"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true">
         ....
       </RelativeLayout>
</RelativeLayout>
like image 110
Dipak Keshariya Avatar answered Jul 23 '26 17:07

Dipak Keshariya


Put your banner inside the RelativeLayout and use android:layout_alignParentBottom="true"
Check the solution in: https://stackoverflow.com/a/5380447/1434631

like image 26
Nermeen Avatar answered Jul 23 '26 17:07

Nermeen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!