Last active
March 14, 2017 05:31
-
-
Save Manabu-GT/10962858 to your computer and use it in GitHub Desktop.
Android - adjust google map's my location button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//HACK: Get the button view and place it on the bottom right (as Google Maps app) | |
View locationButton = ((View) mMapFragment.getView().findViewById(1).getParent()).findViewById(2); | |
RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) locationButton.getLayoutParams(); | |
rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); | |
rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); | |
rlp.setMargins(0, 0, 30, 30); |
Change
View locationButton = ((View) mMapFragment.getView().findViewById(1).getParent()).findViewById(2);
to
View locationButton = ((View) mMapFragment.getView().findViewById(Integer.parseInt("1")).getParent()).findViewById(Integer.parseInt("2"));
It works for me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have implemented this. But getting Error:Error: Expected resource of type id [ResourceType] error when generating a signed apk