开发者

Android Hide RelativeLayout Completely

开发者 https://www.devze.com 2023-02-28 23:13 出处:网络
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 Obje

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.


RelativeLayout.setVisibility(View.GONE);


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


to hide:

RelativeLayout.setVisibility(View.INVISIBLE);

to show it again:

RelativeLayout.setVisibility(View.VISIBLE);
0

精彩评论

暂无评论...
验证码 换一张
取 消