I use the map of Yandex version 3.1.2 in the Androyd application. Showing user location. The round green icon with the letter "I" periodically changes to the yellow arrow. What is the reason, with what event? Is it possible to somehow disable or replace the "arrow" icon?

  • So there the update came out 3.2.0 + the example updated that you are using - iFr0z
  • @iFr0z what example is it? Link please? - Kalinka
  • one
    Well, I just assumed, because You haven't posted the code :) github.com/yandex/mapkit-android-demo - iFr0z
  • one
    In general, the fact is that if you do not specify what the icon will be for displaying the user's location, then the green "I" icon will be displayed. And the yellow arrow is a picture of the png format, which is in your project, namely in drawable. You can change to another image or use Bitmap. I advise Bitmap. - iFr0z
  • iFr0z, thanks! This is what you need. - Kalinka

1 answer 1

Thanks, iFr0z, the github example really helped. I will answer in more detail for those who are interested in this issue. You need to implement UserLocationObjectListener in activit with the map and install the appropriate images:

public class UserLocationActivity extends Activity implements UserLocationObjectListener { ... @Override public void onObjectAdded(UserLocationView userLocationView) { userLocationLayer.setAnchor( new PointF((float)(mapView.getWidth() * 0.5), (float) (mapView.getHeight() * 0.5)), new PointF((float)(mapView.getWidth() * 0.5), (float) (mapView.getHeight() * 0.83))); userLocationView.getArrow().setIcon(ImageProvider.fromResource( this, R.drawable.user_arrow)); CompositeIcon pinIcon = userLocationView.getPin().useCompositeIcon(); pinIcon.setIcon( "icon", ImageProvider.fromResource(this, R.drawable.icon), new IconStyle().setAnchor(new PointF(0f, 0f)) .setRotationType(RotationType.ROTATE) .setZIndex(0f) .setScale(1f) ); pinIcon.setIcon( "pin", ImageProvider.fromResource(this, R.drawable.search_result), new IconStyle().setAnchor(new PointF(0.5f, 0.5f)) .setRotationType(RotationType.ROTATE) .setZIndex(1f) .setScale(0.5f) ); userLocationView.getAccuracyCircle().setFillColor(Color.BLUE); } ... }