Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7704081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:36:18+00:00 2026-05-31T23:36:18+00:00

I have 3 main elements in my XML layout (also see the image): The

  • 0

I have 3 main elements in my XML layout (also see the image):

  1. The header, a linearLayout (nothing exciting here)
  2. The content, a relativeLayout, there is an image in there that I centered both horizontal and vertical.
  3. The footer, a linearLayout

My current setup

What I need this to look like is as following:

  • The footer(3) needs to be aligned to the bottom so there is no white space left
  • The content(2) needs to fill the space between the header(1) and the footer(3) so the image is always centered precisely between the two elements.

What I’ve tried:

  • Setting the content(2) to fill vertically, but it ignores the footer(3) so it overlaps the footer so it isn’t visible anymore.
  • I also tried putting the footer(3) in another LinearLayout that fills the bottom part, and then using the gravity attribute I aligned the footer(3) to the bottom, this looks perfect for the footer(3) but the content(2) keeps it’s size (shown on the image) because the footer(3) is already filling up the space below it.

Can anyone help me with setting up the correct layout?

To recap:
I need the footer(3) to be aligned to the bottom (no white space), keep the header(1) at the top, and all the space in between should be filled with the content(2) part so the centering of the image looks right.

I can provide my current XML-Layout code if needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:36:19+00:00Added an answer on May 31, 2026 at 11:36 pm

    Try like this..

     <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="wrap_content"
            android:layout_height="100dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:orientation="vertical" >
    
        </LinearLayout>
    
        <RelativeLayout
            android:id="@+id/relativeLayout2"
            android:layout_width="wrap_content"
            android:layout_height="200dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/linearLayout1" >
    
        </RelativeLayout>
    
        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/relativeLayout2"
            android:layout_alignParentBottom="true"
            android:orientation="vertical" >
    
        </LinearLayout>
    
    </RelativeLayout>
    

    make a relative layout as the parent layout of all the 3 other layouts and put

    android:layout_below="@+id/relativeLayout2"
            android:layout_alignParentBottom="true"
    

    in the last linear layout

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a res/layout/main.xml including these elements and others: <some.package.MyCustomView android:id=@+id/foo (some other params)
I have a main.xml file describing the layout of my main activity: <?xml version=1.0
I have a custom listView. The main layout xml is something like this: <?xml
Say I have a LinearLayout with some elements in it as an .xml file.
Hi I try to customize a seekbar. Here's my Problem: main.xml ... <SeekBar android:id=@+id/seekBar1
I'm trying to get only elements that have text, ex xml : <root> <Item>
I have this XML file : http://dl.dropbox.com/u/10773282/2011/perf.xml It has two Class elements as is
sometime I have a strange problem with my xml views and contained sub elements
I have a LinearLayout view that already contains several elements. I want to add
I'm dynamically generating a layout, and to do this I have a menu_row_element.xml file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.