Can I Change My Location Button in Android Maps

后端 未结 3 2031
青春惊慌失措
青春惊慌失措 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:18

    Something I am using

        ImageView btnMyLocation = (ImageView) ((View) mapFragment.getView().findViewById(Integer.parseInt("1")).getParent()).findViewById(Integer.parseInt("2"));
        btnMyLocation.setImageResource(R.drawable.ic_current_location);
    
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)
                btnMyLocation.getLayoutParams();
    
        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        layoutParams.setMargins(0, 0, 30, 30);
        btnMyLocation.setLayoutParams(layoutParams);
    

    Hope it will help...

提交回复
热议问题