借鉴与V2地图不同颜色的折线 [英] draw polylines with different colors on v2 maps

查看:145
本文介绍了借鉴与V2地图不同颜色的折线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用绘画对第2版谷歌地图环路多个折线。我现在用的是code设置颜色的折线。

  mMap.addPolyline(新的PolylineOptions()
。新增(新经纬度(拉特,LONS),新的经纬度(晚,孤独))
.WIDTH(5)
。颜色(0xFFFF0000地址));

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


解决方案

 随机RND =新的随机();
  INT颜色= Color.argb(255,rnd.nextInt(256),rnd.nextInt(256),rnd.nextInt(256));
  ---环----   mMap.addPolyline(新的PolylineOptions()
  。新增(新经纬度(拉特,LONS),新的经纬度(晚,孤独))
  .WIDTH(5)
  。颜色(颜色));

I am drawing multiple polylines using for loop on version 2 google map. I am setting color to the polyline using the code.

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

How to increment the RGB color dynamically for each for loop iteration.

解决方案

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

这篇关于借鉴与V2地图不同颜色的折线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆