Skip to content
Advertisement

How to Visible/Invisible using OnClickListener?

I am working on FAQ page I don’t want to use Expandable list view and stuff. So I set 2 TextViews(1 for Question and 1 for Answer) and made one clickable.

working onclick

The above image shows when the first textview mfaq is clicked it sets second one mAns to visible.

The below code works well to Set the mAns textview visible:

JavaScript

So I want to set the visibilty to gone when the textview is clicked again(Should function like Click-visible,ClickAgain-Invisible,Repeat). Note-I am a beginner please try to explain me what the code is doing so I learn more 🙂 Thanks.

Advertisement

Answer

If I understand well you wanna hide/show your textview each time you click on the other text?

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement