Re-position MyLocation button inside Google Map fragment

Viewed 6618

In the Google Maps API for Android there is button located at the top-right corner, served to locate you inside the map.

I would like to know if it is possible to relocate this icon that is by default in the API of Google Maps for Android, because at the top I plan to add an EditText as if it were floating.

enter image description here

2 Answers
    View locationButton = ((View) findViewById(Integer.parseInt("1")).getParent()).findViewById(Integer.parseInt("2"));
    locationButton.setVisibility(View.GONE);
    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);

You can set margin where you likely to locate the My location button.

Related