Let’s say for example that I have a view and I have an algorithm that causes the View’s height to become 0 when it scrolls off screen. Does this View still consume the same amount of memory as it would if it were full size? I guess I should ask the same question for View.INVISIBLE or View.GONE?
Share
Yes – a
Viewis anObjectand as long as anyObjectexists (whether it’s a UI object or not) it uses exactly the same amount of memory. At the point anObjectin an OOP environment ceases to exist (it’s destroyed / de-referenced and garbage collected) then it uses no memory at all. There isn’t very much in-between.Making a UI object invisible or reducing its size in width/height to 0 will simply mean the GPU won’t have to process it in the same way regardless of whether it is on screen or off.