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.

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to find and​ highlight a word in a text field in Sketchware?

A Flash Light App in Sketchware

How to enable download in webview in Sketchware apps?

Intent - Open File By Type

Code for implementing Notifications in Sketchware

How to share an image from Drawable folder?

ActionBar back button

Animation Transtition Animation