我有时看到人们使用 Activity.onAttachedToWindow
方法,但就我个人而言,我从未使用过它。在阅读它的文档时,我觉得它与 onStart()
几乎相同。
我假设的一件事是:
onAttachedToWindow
在 onCreate()
之前被调用
onStop
之后被调用。
我的假设是否正确? 两者的代表是什么?您什么时候使用哪个?
最佳答案
This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).
关于android - onAttachedToWindow 和 onStart 之间的确切区别是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8700406/