2012-08-02 180 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); 

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