Explain the relationship between Android Scroller and Computescroll's calling mechanism _android

Source: Internet
Author: User

What does the scroller in Android ViewGroup have to do with Computescroll?

Answer: There is no direct relationship.

Knowing the answer, does not mean that the following is not necessary to see, if the ViewGroup custom control is not interested, you can not see.

What exactly is 1.Scroller?

A: Scroller is just a calculator that provides interpolation calculations that allow the scrolling process to have animated properties, but it is not a UI, nor is it a sliding auxiliary UI movement, but rather simply provides a calculation for sliding.

Regardless of the constructor method or other methods, as well as the properties of scroller, it does not hold view, auxiliary viewgroup sliding

2.Scroller just provides calculations, then who's going to call Computescroll makes ViewGroup slide

A: Computescroll is not to let viewgroup sliding, really let viewgroup slide is Scrollto,scrollby. The role of Computescroll is to calculate how viewgroup slides. And Computescroll is called through draw.

3.computeScroll and scroller are all computations, what's the relationship between them?

A: The article began to answer, there is no direct relationship. If Computescroll and scroller are flying, it is that computescroll can refer to scroller calculations to influence Scrollto,scrollby, which makes sliding change. That is, Scroller does not call Computescroll, instead, Computescroll calls Scroller.

4. When sliding continuously, how to make the calculation of scroller is continuous?

This asked when to call Computescroll, as said Computescroll call Scroller, as long as the computescroll call continuous, scroller will continue, Essentially Computescroll continuity and Invalidate method control, Scrollto,scrollby will invoke invalidate, and invalidate back to trigger draw, thus computescroll be called continuously, In summary, Scroller will also be called continuously unless invalidate stop the call.

5.computeScroll how to keep in line with the scroller invocation process.

Computescroll reference scroller influence Scrollto,scrollby, in essence, in order not to repeat the effect of Scrollto,scrollby, scroller must terminate the calculation of Currx,curry. To know if the calculation is terminated, you need to pass Mscroller.computescrolloffset ()

The above mentioned is relatively clear, I believe that the Android Scroller and computescroll of the call mechanism of the relationship between it, if there are questions welcome to my message, thank you all the time to the cloud-Habitat community website support.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.