一、   Layout过程

    Layout作用是ViewGroup用来确定子元素位置。当ViewGroup确定后会在onLayout中遍历所有子元素并调用其layout方法,子元素的layout又会调用onLayout。这点和measure的过程很相似。

二、View的getMeasuredWidth和getWidth有什么区别

 

getWideth是测量宽,形成时间较早,是在measure过程中形成的。

   View工作流程----layout过程


三、什么情况会getWidth和getMeasureWidth不一样

    如果重写View的layout方法

    View工作流程----layout过程

相关文章:

  • 2021-09-30
  • 2021-06-30
  • 2022-02-26
  • 2021-08-01
  • 2022-12-23
  • 2021-09-09
  • 2021-10-30
  • 2021-08-29
猜你喜欢
  • 2021-07-03
  • 2022-01-08
  • 2022-01-04
  • 2022-01-16
  • 2022-03-04
  • 2022-01-02
  • 2021-07-02
相关资源
相似解决方案