如何删除按钮或使其在Android的无形? [英] How can I remove a button or make it invisible in Android?

查看:88
本文介绍了如何删除按钮或使其在Android的无形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Android的删除按钮,或使其不可见?

How can I remove a button in Android, or make it invisible?

推荐答案

设置按钮知名度的 GONE (按钮将被彻底删除 - 按键空间将可用于其它部件)或者<一href="http://developer.android.com/intl/zh-TW/reference/android/view/View.html#INVISIBLE">INVISIBLE (按钮,便会成为透明 - 它的空间将无法使用另一个小部件):

Set button visibility to GONE (button will be completely "removed" -- the buttons space will be available for another widgets) or INVISIBLE (button will became "transparent" -- its space will not be available for another widgets):

View b = findViewById(R.id.button);
b.setVisibility(View.GONE);

或XML:

<Button ... android:visibility="gone"/>

这篇关于如何删除按钮或使其在Android的无形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆