How to make a view visible when a button is clicked and make that view invisible when the button is again clicked?
android
Solution
Try the following code to toggle the visibility of the view:
v.setVisibility(v.getVisibility() == View.INVISIBLE ? View.VISIBLE
: View.INVISIBLE);
Problem
I have a layout which is invisible when the activity starts.When I click on a button the layout becomes visible.My requirement is when I click the button for the second time, the layout should be invisible.I know this is a silly question but as I am a new to android, I am unable to figure it out.