笔记6 | 从源码理解分析mScrollX和mScrollY,scrollTo()和scrollBy(),smoothScrollTo和smoothScrollBy

本文通过源码分析,详细解读了mScrollX和mScrollY的含义,scrollTo和scrollBy的区别,以及smoothScrollTo和smoothScrollBy的实现原理。同时探讨了View和ViewGroup在Android UI布局中的角色和关系。
摘要由CSDN通过智能技术生成

前言

我想开头先说说

a.度娘一下什么都知道了,整理这些东西有什么用?还费时费力的!如何才能完全掌握一个知识?当你能把它讲清楚的时候,你才算掌握了他。

想完全把mScrollX和mScrollY,scrollTo()和scrollBy(),smoothScrollTo和smoothScrollBy弄明白并不容易,但查阅他们的源代码基本就能明白个大概,这篇文章就是从源码分析他们究竟有什么作用和区别,读懂了基本就会用!


公众号


目录

  • mScrollX和mScrollY
  • scrollTo()和scrollBy()
  • smoothScrollBy和smoothScrollTo
  • view和viewgroup

一.mScrollX和mScrollY

 
 
 
  1. /**
  2. * The offset, in pixels, by which the content of this view is scrolled
  3. * horizontally.
  4. * {@hide}
  5. */
  6. @ViewDebug.ExportedProperty(category = "scrolling")
  7. protected int mScrollX;
  8. /**
  9. * The offset, in pixels, by which the content of this view is scrolled
  10. * vertically.
  11. * {@hide}
  12. */
  13. @ViewDebug.ExportedProperty(category = "scrolling")
  14. protected int mScrollY;
  15. /**
  16. * Return the scrolled left position of this view. This is the left edge of
  17. * the displayed part of your view. You do not need to draw any pixels
  18. * farther left, since those are outside of the frame of your view on
  19. * screen.
  20. *
  21. * @return The left edge of the displayed part of your view, in pixels.
  22. */
  23. public final int getScrollX() {
  24. return mScrollX;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值