java - 在 v2 map 上绘制不同颜色的折线

标签 java android google-maps rgb

我在第 2 版谷歌地图上使用 for 循环绘制多条折线。我正在使用代码为折线设置颜色。

mMap.addPolyline(new PolylineOptions()
.add(new LatLng(lats, lons), new LatLng(late,lone))
.width(5)
.color(0xFFFF0000)); 

如何为每个 for 循环迭代动态增加 RGB 颜色。

最佳答案

  Random rnd = new Random(); 
  int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));  
  --- loop ----

   mMap.addPolyline(new PolylineOptions()
  .add(new LatLng(lats, lons), new LatLng(late,lone))
  .width(5)
  .color(color)); 

关于java - 在 v2 map 上绘制不同颜色的折线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16214275/

相关文章:

java - xtify + Phonegap 启用声音和振动

Java 管理员权限 (UAC)

android - 自定义 Android 应用程序安装

google-maps - 在悬停时更改标记的 z 索引以使其可见

java - 如何将局部变量的值传递给另一个方法

java - 无法在 Apache Tomcat 服务器上启动 Spring Boot 应用程序(WAR 文件)

安卓超时错误

android - 让 picasso 预取即将到来的图像

javascript - 如何使用完全相同的谷歌地图样式和 PIN 位置?

javascript - Google Maps Api,自定义标记 anchor