Home > DeveloperSection > Forums > How to hide and show editText?
Hugh Jackman
Hugh Jackman

Total Post:52

Posted on    October-14-2014 1:38 AM

 Android Android  Mobile Development 

 1 Reply(s)
 1013  View(s)
Rate this:
I have an editText(hidden by default) and a button. I want to show the editText on click of the button and hide when the button again is pressed. Also the editText should hide if the editText box loses focus. How can this be done? Thank you for the help in advanced.

Kamlakar Singh
Kamlakar Singh

Total Post:194

Posted on    October-14-2014 1:39 AM

You can use like this And the main concept here is editText.setVisibility(View.GONE).

Button button = (Button) findViewById(R.id.button);
        final EditText editText = (EditText) findViewById(R.id.edittext);

        button.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                } else {

Don't want to miss updates? Please click the below button!

Follow MindStick