Difference between setVisible_INVISIBLE and setVisible_GONE

Though both setVisible INVISIBLE and setVisible GONE appear to achieve similar tasks, but both are different.

With setVisible INVISIBLE object remains on screen but is not seen. Whereas with setVisible GONE, object disappears from screen.

Here is an illustration. Suppose there are six imageviews arranged horizontally inside a linear horizontal as shown below.

Now in the Logic section, if the fourth image is set VISIBLE and rest of the images are set INVISIBLE,
the fourth image will be visible at it's position and rest of the images will disappear, as shown in the image below.

Whereas if the fourth image is set VISIBLE and rest of the images are set GONE,
all other images will disappear and fourth image will shift to left to occupy the initial available space on left side, as shown in the image below.

It appears to be a simple difference but it is important to be aware of this as it can be useful in fixing many bugs in android games and apps.

Comments

Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Simple car racing android game in Sketchware

Firebase auth in Sketchware for Login Activity