If foo is a view, what is the difference between foo.setVisibility(View.GONE)
and fooParent.removeView(foo)
? I am particularly interested in memory consumption of the view, before and after both statements.
Does a view with visibility set to GONE consume memory ?
A View's visibility status is of Integer type and can have one of three options: VISIBLE (0) - The View is visible to the user. INVISIBLE (4) - The View is invisible to the user, but still takes up space in the layout. GONE (8) - The View is invisible, and it does not take up space in the layout.
When a View is gone, it means it doesn't take any space in the layout. When it is invisible, it will take the necessary room in a layout but you just don't see it.
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. In your example, you are overriding the View.
You only need to add android:visibility=”gone” in the start constraintset (in the motionscene file) to do that. The default behavior we apply on visibility change plays on alpha channel as well as bounds.
If you need to remove them and then show them again, it could be better to just set visibility to gone and then change back to visible again.
If you on the other hand don't need them visible again, simply remove them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With