2012-01-27 66 views
0
onTouch(MotionEvent event){ 
int x = (int) event.getX(); 
int y = (int) event.getY(); 

if(event.getAction==MotionEvent.DOWN){ 
     temp_point = new ArrayList<Point>(); 
     temp_point.add(new Point(x,y); 
}else if(event.getAction==MotionEvent.MOVE){ 
     if(temp_point!=null) 
      temp_point.add(new Point(x,y); 
}else if(event.getAction==MotionEvent.UP){ 
     mainPoint.add(temp_point); 
     temp_point = null; 
} 
return true; 

}怎麼辦android系統

撤消我用的帆布做漆。我可以清除油漆,但是我無法撤消最後的油漆。

+7

試圖撤銷_what_? – Nailuj 2012-01-27 13:05:25

+2

你想要做什麼...請描述你的問題... – 2012-01-27 13:48:55

回答

0

如果您有興趣在這種情況下執行撤銷/重做,您應該查看Command Pattern

它與Android本身無關。您可以自行實施該功能。

0

您可以將繪畫對象放在一個數組中,例如paint []。 我嘗試粗略地找出它。

Paint [] paint = new Paint [counter] // counter是你想要的對象的數量。

當你想新噴漆的對象適用於畫布和並聯您計數器增加數組的對象將創造新的..

當你撤消那麼你的計數器將遞減,這樣你可以得到前一個對象的油漆,你可以申請帆布其手段其撤消你的帆布。