Can I Change My Location Button in Android Maps

后端 未结 3 2045
青春惊慌失措
青春惊慌失措 2021-02-07 11:51

We have a my location Icon in google maps like
\"My I want to change this icon button with my desired I

3条回答
  •  一整个雨季
    2021-02-07 12:30

    I know it is an late reply but this code works for me ..

         ImageView btnMyLocation = (ImageView) ((View) mapFragment.getView().findViewById(1).getParent()).findViewById(2);
            btnMyLocation.setImageResource(R.mipmap.ic_location_circle);
    
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)
                    btnMyLocation.getLayoutParams();
            // position on right bottom
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
            layoutParams.setMargins(0, 0, 30, 30);
    

    Happy coding..!

提交回复
热议问题