java - 改变 RadialGradient,渐变位置?

标签 java android gradient

这是我需要的图片:

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

最佳答案

想通了,

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

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

关于java - 改变 RadialGradient,渐变位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11783140/

相关文章:

CSS3 渐变问题

gradient - 带有渐变边框的 CSS3 圆圈?

r - 如何使用 R 为定性渐变着色(使用独立类别/多维度)

java - FTS3 SQLite 数据库查询

java - Spring 启动: How to bind list of objects on POST in thymleaf

java - Spring 安全 AngularJS 禁止 403

android - 从 Listview 中的 URI 播放音频,但 Seekbar 未在 Android Listview 项目中更新

java - 安卓开发 : Getting data from the web

java - 通过 Glide 在 Activity 之间共享图像

android - Logcat 在收听桌面时钟警报 Intent 时无法在广播接收器的 onReceive 内部工作