Khi sử dụng Google Map API V3 tôi có thể thêm thuộc tính tùy chỉnh theo cách sau:Thêm bất động sản tùy chỉnh để đánh dấu (Google Map Android API V2)
var marker = new google.maps.Marker({
position: userLocation,
map: myGoogleMap,
animation: google.maps.Animation.DROP,
icon: avatar,
title: userName,
customProperty1: bla,
customProperty2: bla,
customProperty3: bla,
...
});
Tôi tự hỏi nếu tôi có thể làm tương tự cho API V2 Android, lý do tôi muốn làm điều này là mỗi cửa sổ thông tin của mỗi điểm đánh dấu cần phải biết một số thông tin của điểm đánh dấu đó. Và tôi đang cố gắng để đạt được điều này trong render
chức năng dưới đây:
private void render(Marker marker, View view) {
int badge = R.drawable.android_face;
if (marker.customProperty)
//here I need to know this property to decide which image to use
badge = R.drawable.bla;
((ImageView) view.findViewById(R.id.badge))
.setImageResource(badge);
}
thử ở đây http://stackoverflow.com/question/14811579/android-map-api-v2-custom-marker-with-imageview – user2725663