A
A
artshelom2018-09-22 23:21:46
Android
artshelom, 2018-09-22 23:21:46

Which method handles events when an element goes out of view?

Hello. What is the name of the method that registers the display of an element on the screen and its departure, using an example I will try to write more precisely what I mean:
Picasso starts loading images only when this element is shown on the screen. That would be the same only when scrolling below for example.
If not for android, then in twitch, if you lower it below the broadcast when viewing the channel, then it collapses.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Chinakin, 2018-09-23
@SaintRepublic

Concerning

starts loading images only when this element is shown on the screen
- in Android Studio there is a RecyclerView - it's almost the same ListView, only it doesn't create the whole list at once, it stores only what fits on the screen, if the element goes out of visibility when scrolling, it is destroyed and a new one is created instead of it further down the list. Well, something like this.
As for the rest, usually the elements do not leave the screen on their own :) So somewhere in the code there is a code that makes the view invisible and, accordingly, some code is executed immediately after this, no events are needed.
Or when using animation, for example, leaving the button outside the screen, an AnimationListener is used, which has an onAnimationEnd that fires when the animation ends, i.e. when the button goes beyond the screen borders to the specified coordinates, the animation will end, the wiretap will work and some code written there will be executed, for example, make the button invisible.
Aside from the question a bit, people often load things when using a ScrollView. Those. when the scroll scrolls to the end, they need to load something else there. They use onScrollChanged, it determines by the coordinates that the scroll has reached the end, and then do some of their actions.
I don't understand about twitch...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question