Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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 {
                       ???????????
                    }
                }
            });
like image 366
menu_on_top Avatar asked Dec 12 '22 15:12

menu_on_top


1 Answers

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.

like image 172
pawelzieba Avatar answered Dec 15 '22 05:12

pawelzieba