You can first convert it into Bitmap and change its size and then use that bitmap in as a custom marker. For example I first created a method which accepts name of your image file in drawable folder, and width and height of marker you want to set.
public Bitmap resizeMapIcons(String iconName,int width, int height){
Bitmap imageBitmap = BitmapFactory.decodeResource(getResources(),getResources().getIdentifier(iconName, "drawable", getPackageName()));
Bitmap resizedBitmap = Bitmap.createScaledBitmap(imageBitmap, width, height, false);
return resizedBitmap;
}
Then call like this in setUpMap() method to create a new marker of required size.
googleMap.addMarker(new MarkerOptions()
.title("New Marker")
.snippet("Check out this place.")
.position(chelsea).icon(BitmapDescriptorFactory.fromBitmap(resizeMapIcons("image_name",100,100))));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…