visibility="gone"
时间: 2023-10-11 21:07:59 浏览: 33
visibility属性中的"gone"表示控件完全隐藏,不仅不可见,而且不占用任何空间。当我们在XML文件中将一个控件的visibility设置为"gone"时,该控件将不会显示并且不会占用任何布局空间。在类文件代码中,如果使用setVisibility方法将控件的可见性设置为"Invisible",则该控件将仍然占用原来的空间,只是不可见而已。
相关问题
android:visibility="GONE"
在Android开发中,android:visibility="GONE"是一种视图的可见性属性。当一个视图的可见性设置为GONE时,该视图将不会在屏幕上显示,并且不会占用任何空间。
具体来说,当一个视图的可见性设置为GONE时,它将会被隐藏,并且不会对布局产生任何影响。相比之下,当可见性设置为INVISIBLE时,视图也会被隐藏,但是它仍然会占用布局空间。
使用android:visibility="GONE"可以在需要时动态地隐藏或显示视图。这在处理动态布局或根据特定条件显示或隐藏视图时非常有用。
下面是一些相关问题:
android:visibility="gone"
The attribute android:visibility="gone" is used in Android XML layouts to hide a view completely from the user interface. When a view is set to "gone", it does not take up any space on the screen and is not visible to the user. This is different from setting the visibility to "invisible" where the view is hidden, but still takes up space on the screen. The "gone" visibility attribute can be useful in cases where a view should only be displayed under certain conditions, but should not take up any space when it is not needed.