title: Toggling a TextView visibility on click
body: <p>I want to toggle textView on click. <a href="https://i.stack.imgur.com/m36ig.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m36ig.png" alt="enter image description here"></a></p>
  
  <pre><code>val targetView = findViewById&lt;TextView&gt;(R.id.targetText)
  targetView.text = 'example'
  targetView.setOnClickListener {
    if (it.visibility == View.VISIBLE) {
      it.visibility = View.INVISIBLE
    } else {
      it.visibility = View.VISIBLE
    }
  }
  </code></pre>
  
  <p>But once I clicked and visibility of text was changed to invisible, then I can not click this again.</p>