Google maps Xamarin : moving the compass button

2019-08-25 03:08发布

Can I move compass button to a different location ?

On top I have menu and that covers my compass

2条回答
放我归山
2楼-- · 2019-08-25 03:23

You can not pick arbitrary positions for those controls, but you can set the padding to move the controls away from the border to allow for your controls.

googleMap.SetPadding(0,30,0,0);

This method allows you to define a visible region on the map, to signal to the map that portions of the map around the edges may be obscured, by setting padding on each of the four edges of the map. Map functions will be adapted to the padding. For example, the zoom controls, compass, copyright notices and Google logo will be moved to fit inside the defined region, camera movements will be relative to the center of the visible region, etc.

Note: Just remember not to cover the Google Copyright notice as that is against their TOS and will cause a Store rejection...

查看更多
淡お忘
3楼-- · 2019-08-25 03:34

I tried another approach in my map renderer since I did not like that the Google Copyright notice also move using SetPadding.

//Find and move the compass. Android.Views.View compass = FindViewWithTag("GoogleMapCompass"); compass.SetX(200); compass.SetY(200);

Not sure if using FindViewWithTag to find the compass view is a good idea but it works for now.

查看更多
登录 后发表回答