什么事件表明 a 的抽签View
完成了?
我知道ViewTreeObserver
听众,但我找不到“最终”的,这表明工作已经完成。
什么事件表明 a 的抽签View
完成了?
我知道ViewTreeObserver
听众,但我找不到“最终”的,这表明工作已经完成。
yourView.post(someRunnable)
确保someRunnable
在布局和绘制视图后执行。
什么事件表示 TextView 的绘制完成?
View 类(或 TextView)没有这样的钩子。但是,onDraw()
当视图应该呈现其内容时,会调用一个方法。
所以你可以这样做:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Finished drawing. Do other stuff.
// However you must check if this is the first or subsequent call.
// Each call to "invalidate()" will trigger re-drawing.
}
如果我正确理解您的问题,您正在寻找的方法是onWindowFocusChanged(boolean hasFocus)
. 或者你可以试试这个onPostResume()
方法。