I’m using Google Maps v2 API for android and I don’t manage to control the transparency of the fillColor.
I would like to be able to see the map under a filled polygon.
Is there a way to do that ?
Thanks for any help !
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, let me describe how standard 4 bytes color is encoded:
Standard pixel color consists of 4 bytes:
Each channel represents the saturation of particular color part. So if we need to create fully opaque red color, we need to specify following channel values:
If we want to make it half-transparent, we need to divide alpha channel value by 2 (255/2 = 127):
So let’s go back to the android. In Android in most cases you can specify color by specifying it’s hex value:
polygon.setFillColor(0xFF00FF00); //not transparent green colorIn hex every channel can be specified by 2 hex digits:
If you want to make this color half-transparent, you need to divide
FFby 2:polygon.setFillColor(0x7F00FF00); //half-transparent green colorSo basically what you need to do – is to play with alpha channel value in order to get transparency you are looking for