开发者

Visible and invisible with a checkbox

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜