我在游戏中获得了一个画布和位图,我想添加一个计时器。 但是,我看到的所有教程都使用了TextView。在我的应用程序中,我看不到TextView,因为我上面有一个Canvas和Bitmaps。 我怎么能创建一个计时器,虽然这个问题。 谢谢!这是代码:
while(pressed!=true){
if (!holder.getSurface().isValid())
continue;
Canvas c= holder.lockCanvas();
c.drawBitmap(galaxy, 30, 0, null);
c.drawBitmap(player, x-(player.getWidth()/2), y-(player.getHeight()/2), null);
c.drawText("2:34", 30, 60, timerpaint);
holder.unlockCanvasAndPost(c);
}