8

I am using a Custom View. On the Custom View I am plotting some Graph. And also I am using TextView on my layout. When I am making this TextView VISIBLE and INVISIBLE on button click , it is clearing graph.Why it is clearing graph with both GONE and INVISIBLE?

Any Idea?

Tejas
  • 423
  • 1
  • 4
  • 16

2 Answers2

58

Read more about Android : difference between invisible and gone?

From Documentation you can say that

View.GONE This view is invisible, and it doesn't take any space for layout purposes.

View.INVISIBLE This view is invisible, but it still takes up space for layout purposes.


Lets clear the idea with some pictures.

Assume that you have three buttons, like below

enter image description here

Now if you set visibility of Button Two as invisible (View.INVISIBLE), then output will be

enter image description here

And when you set visibility of Button Two as gone (View.GONE) then output will be

enter image description here

Hope this will clear your doubts.

Community
  • 1
  • 1
Pankaj Kumar
  • 81,071
  • 26
  • 167
  • 187
4

From Android official documentation,

View.GONE This view is invisible, and it doesn't take any space for layout purposes.

View.INVISIBLE This view is invisible, but it still takes up space for layout purposes.

Raptor
  • 51,208
  • 43
  • 217
  • 353