我正在尝试创建一个隐藏/显示类似于“javascript 隐藏和显示”的 .xml 布局项目的功能?如果对象已在 xml 中说明,我该如何完成此操作?
最佳答案
是这样的吗?
Button b=(Button)findViewById(R.id.my_button);
b.setVisibility(View.GONE);
<Button
android:id="@+id/my_button"/>
将按钮更改为您想要更改其可见性的任何元素。
关于android - 在 android 上隐藏/显示 xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13313470/