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


77

我们都知道Android Activity的生命周期Fragment的生命周期。但是视图有什么等效的东西吗?

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

提前致谢 !


4
这不是一个直接的答案,因为其他人已经回答了,但是我邀请您看看LogLifeCycle来了解您的Android应用程序在生命周期方面发生了什么。
Snicolas 2014年

Answers:


69

这不是一个正式文件,但这个最近想出了在Google+上。这些评论也进行了很好的讨论,并提供了一些详细的解释。


6
onSaveInstanceState / onRestoreInstanceState
mbmc


stackoverflow.com/a/45819981/1124942这显示了在我的设备(Sony Z1 Compact)上测试过的Android Activity生命周期和Android View生命周期
Afrig Aminuddin

1
“消费者(个人)和品牌帐户不再可以使用Google+”,这就是答案不应该只是一个链接的原因
Ultimo_m


12

在这里,我创建了扩展视图的自定义视图。然后在每种方法中写入日志。的调用的方法这里的顺序:
当运行调试
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
GETZ
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

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.