2011-01-19 76 views

回答

5
Random color = new Random(); 

Color randomColor = new Color(color.nextInt(256),color.nextInt(256),color.nextInt(256)); 

Ofcouse迂腐地說,不放心的是隨機的;)

+0

我已經使用java.awt.color中。對於android,你可以用paint對象做同樣的事情。 Paint p = new Paint(color.nextInt(256),color.nextInt(256),color.nextInt(256),color.nextInt(256))。當然,我可能會將alpha設置爲始終不透明。 – 2011-01-19 09:05:11