How do you check the visibility of the textView?



  • I have one Assimilitis and two titles on it (A and B) above.
    Down. LinearLayoutThere are many components on it... When you press "B" of the lower components, only one TextView I have to hide when I press "A," TextView I'll be back.
    I thought we should use it. ViewPagerBut because of one text, I think it's wrong to write so much code.

    How to use or how to check whether or not TextView or not? ?



  • In order to verify the visibility of the view, a visual condition shall be obtained by means of a method getVisibility() and compare to possible:View.VISIBLEView.INVISIBLEView.GONE😞

    if (textView.getVisibility() == View.VISIBLE) {
        // действия, когда виджет видим
     } else {
        // действия, когда невидим.
     }
    

    To indicate the visibility for the view, a method is used setVisibility()has three parameters:

    View.VISIBLE - I see it on the screen.
    View.INVISIBLE - I don't see, but I take a spot on the mark.
    View.GONE - invisible and unspeakable.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2