开发者

Visible and invisible with a checkbox

开发者 https://www.devze.com 2023-02-13 03:40 出处:网络
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 e开发者_运维百科dittexts.i would like,the 6th line to be invisible when i

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 e开发者_运维百科dittexts.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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号