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 6961499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:32:17+00:00 2026-05-27T15:32:17+00:00

I have the following setup to get a layout with header and footer. Since

  • 0

I have the following setup to get a layout with header and footer. Since the activity is displayed in a dialog, i want to set the height of the top element to “wrap_content”. Regarding to the android docs this not possible as long as you set alignParentBottm=”true” to a child element.

In an other question someone proposed to use a LinearLayout and set the maxHeight programmatically. Are there any other ways to avoid alignParentBottom=”true” ?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/LNL_TOP"
        android:layout_width="match_parent"
        android:layout_height="60dip"
    android:layout_alignParentTop="true"> 
    </LinearLayout>

    <LinearLayout
        android:id="@+id/LNL_BOTTOM"
        android:layout_width="match_parent"
        android:layout_height="60dip"
        android:layout_alignParentBottom="true">
    </LinearLayout>

    <LinearLayout
        android:id="@+id/LNL_CONTENT"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/LNL_TOP"
    android:layout_above="@+id/LNL_BOTTOM">

         <ListView
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>

    </LinearLayout>   
 </RelativeLayout>

Here is an image of what it currently looks like, I want the layout to wrap the content and avoid the empty space under the list.

enter image description here

  • 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-27T15:32:18+00:00Added an answer on May 27, 2026 at 3:32 pm

    Use a vertical LinearLayout instead:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
    
        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="HEAD"/>
        <!--LinearLayout containing the list here, to go with your posted code, 
    it would also work to just have the list outside the layout.-->
        <LinearLayout 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_weight="1">
            <ListView 
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </LinearLayout>
        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="FOOT"/>
    </LinearLayout>
    

    With this, the body will grow with its content until there is no more space. Then it will start to go down behind the footer (although this shouldn’t be a problem as you use a ListView for the contents, so the view will expand to maximum size and then stop, and the scrolling will start to work).

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

Sidebar

Related Questions

I have the following setup. The folder itext is in the top level in
what I want to do is as following: I have a set of Drawables
I have a simple layout to get/set states of IOs of an USB board.
I have the following setup - and don't get any response when I visit
I have following setup, but when I put 1024 and replace all 512 with
I have following models setup in my Django application class School(models.Model): name = models.TextField()
I have the following setup: Code on my local machine (OS X) shared as
I have the following setup, and I need to know how to persist state.
I have the following setup, and the empty view text doesn't show up... protected
I have the following setup: eclipse a standard Java project (A) an eclipse plugin

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.