Android View创建和销毁调用的所有方法

很久没有写东西了,今天来公司比较早,弄个小知识,了解View的动作,才能让它有更大的作为

View 的创建 

setOverScrollMode()

setLayoutParams()
requestLayout()
hasFocus()
hasTransientState()

isClickable()
isLongClickable()
getAccessibilityNodeProvider()
dispatchVisibilityChanged()
onVisibilityChanged()
dispatchVisibilityChanged()
onVisibilityChanged()
jumpDrawablesToCurrentState()
jumpDrawablesToCurrentState()
jumpDrawablesToCurrentState()
onAttachedToWindow()
jumpDrawablesToCurrentState()
isFocused()
onWindowVisibilityChanged()
refreshDrawableState()
drawableStateChanged()
getVisibility()
getLayoutParams()
onMeasure()
getSuggestedMinimumWidth()
getSuggestedMinimumHeight()
getLayoutParams()
getVisibility()
getLayoutParams()
layout()
isOpaque()
onSizeChanged()
isOpaque()
getMatrix()
isOpaque()
onLayout()
requestFocus()
forceLayout()
dispatchWindowFocusChanged()
onWindowFocusChanged()
refreshDrawableState()
 drawableStateChanged()
getVisibility()
getLayoutParams()
onMeasure()
getSuggestedMinimumWidth()
getSuggestedMinimumHeight()
getLayoutParams()
getVisibility()
getLayoutParams()
layout()
onLayout()
getLayerType()
getAnimation()
getLayerType()
computeScroll()
draw()
onDraw()
dispatchDraw()
hasOverlappingRendering()

点击View方法执行顺序

dispatchTouchEvent()
onFilterTouchEventForSecurity()
onTouchEvent()

下拉状态栏,会执行下面方法。
 

dispatchWindowFocusChanged()
onWindowFocusChanged()
isPressed()
isPressed()
refreshDrawableState()
drawableStateChanged()


返回键退出状态栏
 

dispatchWindowFocusChanged()
onWindowFocusChanged()
refreshDrawableState()
drawableStateChanged()


锁屏

onScreenStateChanged()
dispatchSaveInstanceState()

解屏
 

onScreenStateChanged()


旋转

dispatchSaveInstanceState()
onWindowVisibilityChanged()
onDetachedFromWindow()
destroyDrawingCache()
setOverScrollMode()
setLayoutParams()
requestLayout()
hasFocus()
hasTransientState()
isClickable()
isLongClickable()
getAccessibilityNodeProvider()
dispatchRestoreInstanceState()
dispatchVisibilityChanged()
onVisibilityChanged()
dispatchVisibilityChanged()
onVisibilityChanged()
jumpDrawablesToCurrentState()
jumpDrawablesToCurrentState()
jumpDrawablesToCurrentState()
onAttachedToWindow()
jumpDrawablesToCurrentState()
isFocused()
onWindowVisibilityChanged()
refreshDrawableState()
drawableStateChanged()
getVisibility()
getLayoutParams()
onMeasure()
getSuggestedMinimumWidth()
getSuggestedMinimumHeight()
getLayoutParams()
getVisibility()
getLayoutParams()
layout()
isOpaque()
onSizeChanged()
isOpaque()
getMatrix()
isOpaque()
onLayout()
requestFocus()
forceLayout()
dispatchWindowFocusChanged()
onWindowFocusChanged()
refreshDrawableState()
drawableStateChanged()
getVisibility()
getLayoutParams()
onMeasure()
getSuggestedMinimumWidth()
getSuggestedMinimumHeight()
getLayoutParams()
getVisibility()
getLayoutParams()
layout()
onLayout()
getLayerType()
getAnimation()
getLayerType()
computeScroll()
draw()
onDraw()
dispatchDraw()
hasOverlappingRendering()

退出
 

dispatchWindowFocusChanged()
onWindowFocusChanged()
isPressed()
isPressed()
refreshDrawableState()
drawableStateChanged()
dispatchWindowVisibilityChanged()
onWindowVisibilityChanged()
onDetachedFromWindow()
destroyDrawingCache()

猜你喜欢

转载自blog.csdn.net/qq_39897005/article/details/82453845