Change properties of Google Maps PolyLine - 'setStartCap' and 'setEndCap' - rotate and color

0

I'm working with Polylines on google maps.

The question is that I want to add arrows on the line that is created. But researching I found the properties of setStartCap and setEndCap , which allow me to insert an image at the beginning or end of the Polyline.

With this my problem begins, because I have already managed to insert the arrows I want, however I do not know how to change the color and rotation of the image. The original code is as follows:

mPolyline.setEndCap(
    new CustomCap(BitmapDescriptorFactory.fromResource(R.drawable.arrow),
            16));

With this line of code I can insert an arrow at the end of my Polyline, but I still have to add the color and the rotation (so that the arrow makes sense).

Investigating a bit I managed to make it rotate:

//Arrow
    Bitmap bmpOriginal = BitmapFactory.decodeResource(this.getResources(), R.drawable.right_arrow_button);
    Bitmap bmResult = Bitmap.createBitmap(bmpOriginal.getWidth(), bmpOriginal.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas tempCanvas = new Canvas(bmResult);
    tempCanvas.rotate(260, bmpOriginal.getWidth()/2, bmpOriginal.getHeight()/2);
    tempCanvas.drawBitmap(bmpOriginal, 0, 0, null);



    mPolyLine.setEndCap(new CustomCap(BitmapDescriptorFactory.fromBitmap(bmResult),8));

With the previous code, the position of the arrow is already changed, but I can not change the color of this one. Besides that I do not know if it is the most optimal.

My question is, how can I achieve that the image is 'rotated' according to an angle and how can I change the color of it, in the most optimal way possible?

Thank you very much in advance.

    
asked by Alan Oliver 05.01.2019 в 04:38
source

1 answer

0

It is not clear to me that you want to rotate a polyline, but here I let you change its color.

mPolyline.color(Color.GREEN);
    
answered by 06.01.2019 в 16:10