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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:42:20+00:00 2026-05-14T06:42:20+00:00

I am having a problem with views overlapping in a RelativeLayout on Android 1.5…

  • 0

I am having a problem with views overlapping in a RelativeLayout on Android 1.5… Everything is working fine on Android 1.6 and above.

I do understand that Android 1.5 has some issues with RelativeLayout, but I was not able to find anything on StackOverflow or the android beginners group for my specific problem.

My layout consists of four sections, each of which are made up of a TextView, a Gallery, and another TextView aligned vertically:

Running Apps
Recent Apps
Services
Processes

When all four sets of these items are displayed everything works fine. However, my app allows the user to specify that some of these are not displayed. If the user turns off Running Apps, Recent Apps, or Services then the remaining sections all of a sudden overlap eachother.

Here is my code for the layout. I’m not sure what I am doing wrong. When the user turns off display of a section I use the View.GONE visibility setting:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center_vertical"
    android:layout_gravity="center_vertical"
    android:background="@null"
>
<!-- Running Gallery View Items -->
<TextView 
    style="@style/TitleText"
    android:id="@+id/running_gallery_title_text_id"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="left"
    android:paddingLeft="1sp"
    android:paddingRight="10sp"
    android:text="@string/running_title"
/>

<Gallery
    android:id="@+id/running_gallery_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/running_gallery_title_text_id"
    android:spacing="5sp"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:unselectedAlpha=".5"
/>

<TextView 
    style="@style/SubTitleText"
    android:id="@+id/running_gallery_current_text_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/running_gallery_id"
    android:gravity="center_horizontal"
/>

<!-- Recent Gallery View Items -->
<TextView 
    style="@style/TitleText"
    android:id="@+id/recent_gallery_title_text_id"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/running_gallery_current_text_id"
    android:gravity="left"
    android:paddingLeft="1sp"
    android:paddingRight="10sp"
    android:text="@string/recent_title"
/>

<Gallery
    android:id="@+id/recent_gallery_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/recent_gallery_title_text_id"
    android:spacing="5sp"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:unselectedAlpha=".5"
/>

<TextView 
    style="@style/SubTitleText"
    android:id="@+id/recent_gallery_current_text_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/recent_gallery_id"
    android:gravity="center_horizontal"
/>

<!-- Service Gallery View Items -->
<TextView 
    style="@style/TitleText"
    android:id="@+id/service_gallery_title_text_id"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/recent_gallery_current_text_id"
    android:gravity="left"
    android:paddingLeft="1sp"
    android:paddingRight="10sp"
    android:text="@string/service_title"
/>

<Gallery
    android:id="@+id/service_gallery_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/service_gallery_title_text_id"
    android:spacing="5sp"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:unselectedAlpha=".5"
/>

<TextView 
    style="@style/SubTitleText"
    android:id="@+id/service_gallery_current_text_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/service_gallery_id"
    android:gravity="center_horizontal"
/>
</RelativeLayout>

I ommitted the xml for the Processes section in a (somewhat vain) attempt to keep this shorter…

What can I do to make this work in Android 1.5? I don’t think it is just a matter of reordering the views in the xml because it works fine when everything is displayed.

  • 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-14T06:42:21+00:00Added an answer on May 14, 2026 at 6:42 am

    Two possible solutions:

    • Try setting the element’s height to 0 or 1 px and visibility to INVISIBLE instead of GONE.
    • Wrap each Gallery/TextView in a LinearLayout set to wrap_height, and set the above/belows on the layouts instead of the subviews. Then set the subelements to View.GONE, leaving the linear layouts used for the relative positioning still visible but with wrapped height 0.

    The idea with either solution is to make sure you’re never positioning something relative to a view that’s View.GONE; I’d suspect that’s the source of the bug you’re running into.

    If I may ask, though… why do you even need to use a RelativeLayout here at all? From what I can see at a glance, everything here would fit fine into a vertical LinearLayout, and in fact seems to be conceptually simpler for this arrangement.

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

Sidebar

Ask A Question

Stats

  • Questions 373k
  • Answers 373k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Also from the SQL::Statement::Functions documentation: When using SQL::Statement/SQL::Parser directly to… May 14, 2026 at 7:46 pm
  • Editorial Team
    Editorial Team added an answer Why not simply use printf? One when entering and one… May 14, 2026 at 7:46 pm
  • Editorial Team
    Editorial Team added an answer This is actually being fixed in C++ in the next… May 14, 2026 at 7:46 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.