我是靠谱客的博主 健忘烧鹅,这篇文章主要介绍Android 控件属性,现在分享给大家,希望可以做个参考。

控件显示与否属性

  • View.VISIBLE
    存在且可见。
  • View.INVISIBLE
    存在但不可见
  • View.GONE
    不存在

控件属性可以在manifest中以及程序中进行设置。
原始控件显示如下:
在这里插入图片描述

  • 程序中设置
复制代码
1
2
showButton1.setVisibility(View.INVISIBLE);

在这里插入图片描述

复制代码
1
2
showButton1.setVisibility(View.GONE);

在这里插入图片描述

  • Manifest中设置
复制代码
1
2
3
4
5
6
7
8
<Button android:id="@+id/showButton1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="showButton1" android:visibility="visible" />

最后

以上就是健忘烧鹅最近收集整理的关于Android 控件属性的全部内容,更多相关Android内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(97)

评论列表共有 0 条评论

立即
投稿
返回
顶部