2012-08-02 182 views
3

這裏是我所需要的圖像:更改RadialGradient,漸變位置?

http://imgur.com/prXA5 我需要從1去2和它必須是一個編程沒有XML。

//Create transparent circle 
RadialGradient gradient = new android.graphics.RadialGradient(newBitmap.getWidth()/ 2,newBitmap.getHeight()/2, newBitmap.getWidth() - newBitmap.getWidth()/2, 0x00000000, 0xFF000000, android.graphics.Shader.TileMode.CLAMP); 

回答

4

想通了這一點,

//Create transparent circle 
    int[] Colors = {0x00000000, 0xFF000000}; 
    float[] ColorPosition = {0.60f, 0.99f}; 
    RadialGradient gradient = new android.graphics.RadialGradient(newBitmap.getWidth()/2,newBitmap.getHeight()/2, newBitmap.getWidth() - newBitmap.getWidth() /2, Colors, ColorPosition, android.graphics.Shader.TileMode.CLAMP); 

凡色位置上面的顏色的百分比位置(可以有很多,只要你想)