如何计算TextView
渲染一行文本所需的时间?
textView.setText("hello");
您可以扩展 TextView 类并覆盖绘制:
@Override
public void draw(Canvas canvas) {
//log start time
super.draw(canvas);
//log end time
}
@Maxim 的替代方法是在前后记录setText("hello");
Log.i(logTag, "start time");
textView.setText("hello");
Log.i(logTag, "end time");
如果视图仅在调用之后才呈现,这将不起作用setText
。也许有人可以在评论中确认或否认这一点。
在eclipse中使用Android Traceview