Android视图生命周期(状态图)是否有任何图形表示?

时间:2012-10-30 20:03:00

标签: android view lifecycle representation

我们都知道Android Activity's life cycleFragment's life cycle。但是有没有相同的观点?

例如,这可以帮助构建自定义视图或深入了解Android上非常常见且经常隐藏的图形操作。

提前致谢!

2 个答案:

答案 0 :(得分:69)

这不是官方文档,但this最近出现在Google+上。评论也有一些很好的讨论和一些详细的解释。

答案 1 :(得分:8)

这里我创建了扩展View的自定义视图。然后在每个方法中写入日志。这里称为方法的顺序:
运行调试时
setOverScrollMode
setOverScrollMode
onFinishInflate
setLayoutParams
getLayoutDirection
requestLayout
hasFocus
hasTransientState
getVisibility
getLayoutDirection
getLayoutDirection
canResolveLayoutDirection
getLayoutDirection
canResolveTextDirection
isLayoutDirectionResolved
isLayoutDirectionResolved
getLayoutDirection
getLayoutDirection
isLayoutDirectionResolved
isTextDirectionResolved
isTextAlignmentResolved
getLayoutDirection
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
getVisibility
onAttachedToWindow
jumpDrawablesToCurrentState

的getBackground isFocused
被示
onVisibilityAggregated
refreshDrawableState
drawableStateChanged
onCreateDrawableState
isFocused
hasWindowFocus
getVisibility
onMeasure
getSuggestedMinimumWidth
getSuggestedMinimumHeight
getVisibility
getVisibility
onMeasure
getSuggestedMinimumWidth
getSuggestedMinimumHeight
getVisibility
getVisibility
布局
isOpaque
onSizeChanged

的getBackground isOpaque
getMatrix
isOpaque
isHardwareAccelerated
盖茨
getElevation
getTranslationZ
onLayout
getVisibility
getAnimation
getLayerType
getLayerType
computeScroll

onDraw有
dispatchDraw
onDrawForeground
hasOverlappingRendering
dispatchWindowFocusChanged
onWindowFocusChanged
refreshDrawableState
drawableStateChanged
onCreateDrawableState
isFocused
hasWindowFocus

使用此视图打开活动
onScreenStateChanged
getLayoutDirection
getAnimation
getLayerType
getVisibility
getVisibility
getVisibility
布局
getVisibility
dispatchWindowFocusChanged
onWindowFocusChanged
refreshDrawableState
drawableStateChanged
onCreateDrawableState
isFocused
hasWindowFocus