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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:49:42+00:00 2026-05-27T18:49:42+00:00

I have a RelativeLayout view, and 3 children’s views too. I’m trying to hide

  • 0

I have a RelativeLayout view, and 3 children’s views too. I’m trying to hide them all in code by setting the relative layout to INVISIBLE using setVisibility. The funny thing is that when I use setVisibility(View.INIVISIBLE) only the first child is hidden, not the other two. So I’m a bit confused – if I set a parent view to invisible shouldn’t it change the visibility of all the children or leave them all alone?

Feel free to point me to a reference page that explains it – I can’t find anything.

Update: I’ve tried setting it to View.GONE, but the same thing happens, except the two children who remain visible move up a bit.

Here’s the relevant XML:

<RelativeLayout
    android:id="@+id/optionsform"
    android:layout_width="fill_parent"
    android:padding="8dp"
    android:layout_height="wrap_content" >
    
    <TextView
        android:id="@+id/tvoptions"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="@string/tvoptions"
        android:textColor="#f000"
        android:textAppearance="?android:attr/textAppearanceMedium" android:textStyle="bold"/>
    
    <TextView
        android:id="@+id/tvdictionary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/tvoptions"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="16dp"
        android:text="@string/dictionary"
        android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#f000" />

    <Spinner
        android:id="@+id/dictionary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/tvdictionary"
        android:layout_alignParentRight="true"
        android:layout_marginTop="-10dp"
        android:layout_marginLeft="6dp"
        android:layout_toRightOf="@+id/tvdictionary" />

</RelativeLayout>

And here’s the relevant code I’m using:

    public void onClick(View v) {
        //Toggle viewing of options, using "if" in case it is set to View.GONE 
        View view = findViewById(R.id.optionsform);
        if (view.getVisibility() == View.VISIBLE) 
            view.setVisibility(View.INVISIBLE);
        else
            view.setVisibility(View.VISIBLE);
    }
  • 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-27T18:49:43+00:00Added an answer on May 27, 2026 at 6:49 pm

    Solved. An uninstall then install of the app on my android device did the trick. I’ll beware of that in future

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

Sidebar

Related Questions

I have this layout that works correctly, a relative layout with a text view
http://dl.dropbox.com/u/24856/android_issue.PNG i have a text view on top running into the relative layout with
I have designed the screen using this relative layout. <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android
I have 2 views on RelativeLayout I need to invoke(call) onDraw only single view
I have created a custom view by extending Relative Layout and it looks like
Hi im trying to accomplish the following layout. I have two RelativeLayout, each one
So I have a custom view set up in code (no XML layout defined
I've got relative layout in my view hierarchy and I want it to have
I have a ViewFlipper in which I want to add Views (Relative Layout with
I have the following layout: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:background=@drawable/aussie_bg_big > <ImageView android:id=@+id/titleImage android:layout_width=wrap_content

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.