如何创建一个计时器 - 并在画布

时间:2015-05-28 15:11:41

标签: android canvas timer bitmap

我在游戏中获得了一个画布和位图,我想添加一个计时器。 但是,我看到的所有教程都使用了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);
        }

0 个答案:

没有答案