java 在 android studio 中,我可以隐藏和显示标签/文本视图吗?如果是这样,我会用什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29104552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In android studio am I able to hide and show a label/textview? if so what would i use?
提问by Sarju Thakkar
Is there a thing like textview visibility on and off. Thanks in advance.
有没有像 textview 可见性这样的东西打开和关闭。提前致谢。
回答by tomiQrds
In the XML you can set android:visibility="invisible"
or "visible
"
In the Java code you can type YourTextView.setVisiblity(View.VISIBLE)
在 XML 中,您可以设置android:visibility="invisible"
或“ visible
”在 Java 代码中,您可以键入YourTextView.setVisiblity(View.VISIBLE)
回答by Catalina
You can use android:visibility="visible"
for setting visibility in xml. The options are visible|invisible|gone
.
您可以 android:visibility="visible"
用于在xml 中设置可见性。选项是visible|invisible|gone
。
Or textview.setVisibility(View.VISIBLE)
in code.
或者textview.setVisibility(View.VISIBLE)
在代码中。
More info here http://developer.android.com/reference/android/view/View.html#setVisibility(int)
更多信息在这里http://developer.android.com/reference/android/view/View.html#setVisibility(int)