Android Maps API v2 Change MyLocation Icon

后端 未结 6 1724
野趣味
野趣味 2020-11-27 04:50

I would like to replace the default icon that Android Maps V2 uses for \'My Location\' (The little blue dot/arrow) with my own image. I\'ve created my own tile provide

6条回答
  •  旧时难觅i
    2020-11-27 05:47

    Here is the code to access location button:

    View mv=findViewById(R.id.map);
            View locationButton = ((View) mv.findViewById(Integer.parseInt("1")).getParent()).findViewById(Integer.parseInt("2"));
            RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) locationButton.getLayoutParams();
    // position on right bottom
            rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
            rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
            rlp.setMargins(0, 180, 180, 0);
    

提交回复
热议问题