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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:22:30+00:00 2026-05-26T15:22:30+00:00

Ok I have a relative layout inside a linear one.Until now,the relative layout was

  • 0

Ok I have a relative layout inside a linear one.Until now,the relative layout was perfect,however now a big problem appeared.

A relative layout is based on the others item’s position.For ex button2 is at the bottom of button1,and so on…and if button 1 disappears,button2 gets…”nuts”.

That’s my problem, when a button disappears one of the 4 buttons gets…up.
What I need is to position the buttons like this:

Button1 and button 2 at the middle of the screen,and 3 and 4 lower,but not really at the bottom.
I tried to modify it in relative layout but I failed…Hope you can help me.
Here’s the code:

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
        <TextView 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:id="@+id/textView2" 
        android:text="TextView" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_alignParentTop="true" 
        android:layout_alignParentLeft="true">
        </TextView>
        <Button 
        android:textSize="20dp" 
        android:layout_height="wrap_content" 
        android:id="@+id/button3" 
        android:text="Button" 
        android:layout_width="wrap_content"  
        android:layout_alignParentLeft="true" 
        android:layout_marginBottom="27dp" 
        android:layout_alignParentBottom="true">
        </Button>
        <TextView 
        android:layout_height="wrap_content" 
        android:id="@+id/textView1" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:layout_width="wrap_content" 
        android:text="TextView" 
        android:layout_above="@+id/button1" 
        android:layout_centerHorizontal="true" 
        android:layout_marginBottom="74dp">
        </TextView>
        <Button 
        android:textSize="20dp" 
        android:layout_height="wrap_content" 
        android:id="@+id/button2" 
        android:text="Button" 
        android:layout_width="wrap_content" 
        android:layout_alignBaseline="@+id/button1" 
        android:layout_alignBottom="@+id/button1" 
        android:layout_alignParentRight="true">
        </Button>
        <Button 
        android:textSize="20dp" 
        android:layout_height="wrap_content" 
        android:id="@+id/button1" 
        android:paddingRight="30dp" 
        android:paddingBottom="90px" 
        android:text="Button" 
        android:padding="10dp" 
        android:layout_width="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_alignRight="@+id/button3">
        </Button>
        <Button 
        android:textSize="20dp" 
        android:layout_height="wrap_content" 
        android:gravity="bottom" 
        android:id="@+id/button4" 
        android:text="Button" 
        android:layout_width="wrap_content" 
        android:layout_alignBaseline="@+id/button3" 
        android:layout_alignBottom="@+id/button3" 
        android:layout_alignParentRight="true">
        </Button>
    </RelativeLayout>

Here’s the code I use to make the button invisible:

        Button b1 = (Button) findViewById(R.id.button1);
        Button b2 = (Button) findViewById(R.id.button2);
        Button b3 = (Button) findViewById(R.id.button3);
        Button b4 = (Button) findViewById(R.id.button4);
        b1.setVisibility(View.GONE);
  • 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-26T15:22:30+00:00Added an answer on May 26, 2026 at 3:22 pm

    if you are using view.setVisibility(View.GONE)..then try View.INVISIBLE
    here view = (your textview,button anything)

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

Sidebar

Related Questions

here I have a problem with layout, I have taken a linear layout inside
For examples two buttons inside a linear layout or a relative layout. Have each
My application have 3 Relative Layouts and 3 Linear Layouts. Based on the web
I have a background image child inside a relative layout: <ImageView android:layout_width=wrap_content android:layout_height=wrap_content android:scaleType=centerInside
i have a big problem with a layout in my Android Application. I have
I have a big problem with absolute positioned elements inside my main TD. Well,
I have this ImageView block inside a Relative layout: <ImageView android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentBottom=true android:layout_marginBottom=50dip
I have this layout that works correctly, a relative layout with a text view
I have problems getting some of my views aligned in a relative layout that
I'm using a Relative layout as the root or parent container and I have

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.