【问题标题】:Change RadialGradient, gradient position?改变 RadialGradient,渐变位置?
【发布时间】:2012-08-02 17:57:09
【问题描述】:

这是我需要的图片:

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);

【问题讨论】:

    标签: java android gradient


    【解决方案1】:

    想通了,

    //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);
    

    其中颜色位置是上面颜色的百分比位置(可以有很多)

    【讨论】:

      猜你喜欢
      • 2022-01-19
      • 1970-01-01
      • 2016-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-30
      • 1970-01-01
      相关资源
      最近更新 更多