Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Android equivalent of display:none in CSS?

Tags:

What is the android equivalent of the CSS style attribute display:none?

In web pages the display:none stylesheet causes the web page element to which it is applied to be hidden and not occupy any space. When the element's attribute is changed dynamically using Javascript to visible, the browser shows the element moving any other elements surrounding it.

like image 236
Raj Avatar asked Jun 16 '11 11:06

Raj


People also ask

How do I show display none in CSS?

getElementById("element"). style. display = "none"; To show an element, set the style display property to “block”.

What does display none does in CSS?

CSS Display None helps developer to hide the element with display property set to none. For element whose display is set to none no boxes are generated for it and even its child elements which might have display set to values other than none.

What is the opposite of display none in CSS?

opposite of 'none' is 'flex' while working with react native. Show activity on this post. visibility:hidden will hide the element but element is their with DOM. And in case of display:none it'll remove the element from the DOM.

Is hidden the same as display none?

display:none means that the tag in question will not appear on the page at all (although you can still interact with it through the dom). ... visibility:hidden means that unlike display:none , the tag is not visible, but space is allocated for it on the page.


1 Answers

you can use setVisibility on a view. There are 3 options available
VISIBLE - seen by the user
INVISIBLE - not seen by the user. But the view still takes some space.
GONE - not seen by the user, and the view doesn't take up any space.


Adding examples

4 Text views in a LinearLayout oriented vertically, all visible

All visible text views code All visible text views on dev

4 Text views in a LinearLayout oriented vertically, 2 set to invisible 2 text views invisible code 2 text views invisible on dev

4 Text views in a LinearLayout oriented vertically, 2 set to gone 2 text views gone code 2 text views gone on dev

like image 193
bluefalcon Avatar answered Oct 07 '22 18:10

bluefalcon