distinguish the tapped marker from other markers
A low-cost solution to distinguish the tapped marker from other markers with the help of onSingleTapUp & onSingleTapConfirmed method and drawable resources. Works in MarkerClusterer container as well.
Step1.
add drawable resources that can distinguish status from focused and other status;
marker_with_status.xml
`
<item android:drawable="@drawable/marker_default" android:state_focused="true" />
<item android:drawable="@drawable/marker_default_focused_base" />
`
Step2.
replace Marker with MarkerWithStatus, and call setIcon(Drawable icon) method;
MarkerWithStatus startMarker = new MarkerWithStatus(map); startMarker.setIcon(ContextCompat.getDrawable(this,R.drawable.marker_with_status));
Is there a way to show selected marker differently at the moment? The patch is useful.
I provided "marker_with_status.xml" to specify icons which is selected or is not selected. However, this solution is not "elegant".Maybe we can strengthen the class "Marker" and provide a method like "setSelectedIcon".
Dust_2 @.***