计算TextView渲染性能的时间

时间:2012-07-20 05:38:05

标签: android rendering

如何计算TextView呈现一行文字所需的时间?

textView.setText("hello");

3 个答案:

答案 0 :(得分:1)

您可以扩展TextView类并覆盖draw:

@Override
public void draw(Canvas canvas) {
    //log start time
    super.draw(canvas);
    //log end time
}

答案 1 :(得分:0)

在eclipse中使用Android Traceview

答案 2 :(得分:0)

@Maxim的替代方法是在setText("hello");

之前和之后进行记录
Log.i(logTag, "start time");
textView.setText("hello");
Log.i(logTag, "end time");

如果仅在调用setText之后呈现视图,则此操作无效。也许有人可以在评论中确认或否认。