• ViewLife Cycle主要經過onMeasureàonLayoutàonDraw三個步驟
  • View的進行過程是遞迴的概念,最先處理的是View中最小的地方,由下圖範例,執行順序為CàBàA

  • onMeasure主要是測量在Layout中此view的大小
  • onLayout負責將View放在Layout對應的位置中
  • 當程式執行addView將某個View加進Layout時,會在呼叫requestLayout

public void addView(View child, int index, LayoutParams params) {
      // addViewInner() will call child.requestLayout() when setting the new LayoutParams
      // therefore, we call requestLayout() on ourselves before, so that the child's
      // request will be blocked at our level
      requestLayout();
      addViewInner(child, index, params, false);
}

  • requestLayout就會執行onMeasureonLayout
文章標籤
全站熱搜
創作者介紹
創作者 y23462001 的頭像
y23462001

y23462001的部落格

y23462001 發表在 痞客邦 留言(0) 人氣(96)