可见和不可见的复选框 [英] Visible and invisible with a checkbox

查看:236
本文介绍了可见和不可见的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个屏幕有5行。每行有3个editTexts.after第5行后有一个复选框和下面它另一行与3 edittexts.i想,第6行是不可见的,当我第一次打开我的应用程序,并且当用户选中复选框时,出现的行可能是?

  final CheckBox checkbox = findViewById(R.id.box); 
checkbox.setOnClickListener(new OnClickListener(){
public void onClick(View v){
//对点击执行操作,取决于是否现在选中
if(( CheckBox)v).isChecked()){
?????????
} else {
?????????
}
}
});


解决方案

在您的布局xml文件中添加

  android:visibility =gone


$ b



然后在您的代码中:



<$> p $ p> myHiddenView.setVisibility(View.VISIBLE);

以使其可见。


i have a screen with 5 lines.each line has 3 editTexts.after the 5th line there is a checkbox and below it another line with 3 edittexts.i would like,the 6th line to be invisible when i firstly open my app,and when the users checks the checkbox,the line to appear.is this possible?thanks

  final CheckBox checkbox = (CheckBox) findViewById(R.id.box);
            checkbox.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    // Perform action on clicks, depending on whether it's now checked
                    if (((CheckBox) v).isChecked()) {
                       ?????????????
                    } else {
                       ???????????
                    }
                }
            });

解决方案

In your layout xml file add

android:visibility="gone"

to the View that have to be hidden at startup.

Then in your code:

myHiddenView.setVisibility(View.VISIBLE);

to make it visible.

这篇关于可见和不可见的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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