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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:56:11+00:00 2026-06-02T04:56:11+00:00

I have a vertical LinearLayout which has a list view and one ImageView at

  • 0

I have a vertical LinearLayout which has a list view and one ImageView at the bottom and one at top and the list view filled up the space left behind.

It looks like this:

<LinearLayout layout_height="match_parent" layout_width="@dimen/width"
    orientation="vertical"> 
    <ImageView layout_height="@dimen/width" layout_width="@dimen/width" id="@+id/top">

     <ListView  android:layout_height="0px"
        android:background="#00ffff"
        android:layout_width="@dimen/width"
        android:layout_weight="1" />

     <ImageView layout_height="@dimen/width" layout_width="@dimen/width" id="@+id/bottom" layout_gravity="bottom|center_horizontal">

It works fine whenever I have the list view visible.

But whenever I set the ListView to visibility gone, the ‘bottom’ ImageView will popup to be just underneath the top Image View.

My question is why the bottom ImageView does not stay at the bottom despite I said ‘ android:layout_gravity=”bottom|center_horizontal”‘ I have looked at hierarchyViewer, the height of the parent does match the screen’s height. So the bottom Image view should honor the android:layout_gravity=”bottom|center_horizontal” and stay at the bottom, right?

  • 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-06-02T04:56:13+00:00Added an answer on June 2, 2026 at 4:56 am

    As alternative to my comments, you can replace your LinearLayout with a RelativeLayout. Agarwal already suggested this, but his code is a bit of a mess and at the time of this writing not correct in terms of what you want it to do.

    Give below code a try. When you set the ListView to gone, the top and bottom images will stay positioned identical to when it’s visible. Do note that I replaced the @dimens/width references, so you might want to put those back in.

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
    
        <ImageView android:id="@+id/top" android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    
        <ListView android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:layout_above="@+id/bottom"
            android:layout_below="@+id/top" android:background="#00ffff" />
    
        <ImageView android:id="@+id/bottom" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true" />
    
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a linearlayout in which i have one image view, one textview ,
I am trying to use a SlidingDrawer which has a bottom to top structure..
Context: I have a TableLayout (created using XML), which has one TableRow, which has
I have a LinearLayout, which only contains one button. I want this button to
I want to make a menu, which contains 4 different LinearLayouts. Top one has
I have the linearlayout which has the background set as rect.xml as mentioned below.
I have a vertical menu in my system which is basically made of HTML
I have a vertical NSSplitView containing on one of its sides a NSScrollView with
I have a vertical accordion which opens perfectly fine when starting to open the
In Silverlight, I have a Vertical ListBox that has a Horizontal ListBox for each

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.