2015-02-08 136 views
0

我有一個位圖和一個文本。我只是想在我的位圖上放置文本,但問題在於位圖後面繪製了文本。誰能幫我?在繪製位圖上繪製文本

 canvas.drawText("10", (mazeFinishX1 * totalCellWidth) 
      + (cellWidth/10), (mazeFinishY1 * totalCellHeight) 
      + (cellHeight * 0.75f), ball); 
    canvas.drawBitmap(lvl1_portal1, (mazeFinishX1 * totalCellWidth) 
      + (cellWidth/20), (mazeFinishY1 * totalCellHeight) 
      + (cellWidth/20), ball); 

我已經測試過了。文字出現在位圖後面。

+0

如果你發佈你的代碼,也許有人可以解決這個問題 – Blackbelt 2015-02-08 15:58:58

+1

。謝謝先生 – user3698267 2015-02-08 16:15:42

回答

1

首先繪製位圖,然後是文本。

canvas.drawBitmap(lvl1_portal1, (mazeFinishX1 * totalCellWidth) 
     + (cellWidth/20), (mazeFinishY1 * totalCellHeight) 
     + (cellWidth/20), ball); 
canvas.drawText("10", (mazeFinishX1 * totalCellWidth) 
     + (cellWidth/10), (mazeFinishY1 * totalCellHeight) 
     + (cellHeight * 0.75f), ball); 

訂單事宜。

0

使用此代碼。你畫錯了順序。

canvas.drawBitmap(lvl1_portal1, (mazeFinishX1 * totalCellWidth) 
      + (cellWidth/20), (mazeFinishY1 * totalCellHeight) 
      + (cellWidth/20), ball); 
    canvas.drawText("10", (mazeFinishX1 * totalCellWidth) 
      + (cellWidth/10), (mazeFinishY1 * totalCellHeight) 
      + (cellHeight * 0.75f), ball);