GuyFawkes
GuyFawkes

Reputation: 1706

Android Hide RelativeLayout Completely

I want to hide a relative layout completely. i have a view with several Layouts i use as buttons with an onClickListener. Now i want to display only those Buttons that i want because sometimes an Object doesnt have all Data. I tried to set visiblity to "4" wich should be "gone" but that didnt do the trick. there still is space reserved for this Layout. What can i do about this?

Thank you.

Upvotes: 1

Views: 6414

Answers (3)

Firda Sahidi
Firda Sahidi

Reputation: 1281

to hide:

RelativeLayout.setVisibility(View.INVISIBLE);

to show it again:

RelativeLayout.setVisibility(View.VISIBLE);

Upvotes: 1

Niranj Patel
Niranj Patel

Reputation: 33248

RelativeLayout.setVisibility(View.GONE);

Upvotes: 10

NickT
NickT

Reputation: 23873

You should set it to View.GONE which is 8 not 4

Upvotes: 7

Related Questions