구글맵 줌버튼 위치 조정
// 구글맵
@Override
public void onMapReady(final GoogleMap map) {
LatLng SEOUL = new LatLng(37.56, 126.97);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(SEOUL);
markerOptions.title("서울");
markerOptions.snippet("한국의 수도");
map.addMarker(markerOptions);
map.moveCamera(CameraUpdateFactory.newLatLng(SEOUL));
map.animateCamera(CameraUpdateFactory.zoomTo(17)); // 2 (축소) to 21 (확대)
UiSettings mapUiSettings = map.getUiSettings();
mapUiSettings.setZoomControlsEnabled(true); // 줌버튼
// 줌버튼 컨트롤러 위치 조정
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
View zoomControls = mapFragment.getView().findViewById(0x1);
if (zoomControls != null && zoomControls.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
// ZoomControl is inside of RelativeLayout
RelativeLayout.LayoutParams params_zoom = (RelativeLayout.LayoutParams) zoomControls.getLayoutParams();
// Align it to - parent top|left
params_zoom.addRule(RelativeLayout.ALIGN_PARENT_TOP);
params_zoom.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
// Update margins, set to 10dp
final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10,
getResources().getDisplayMetrics());
params_zoom.setMargins(margin, margin, margin, margin);
}
}
'프로그래밍 > Android (Java)' 카테고리의 다른 글
[알림] addPreferencesFromResource 줄 처져 있을 때 (0) | 2019.07.04 |
---|---|
TextView 줄간격, 자간, 장평 변경하기 (0) | 2019.07.02 |
어플 아이콘 변경 (0) | 2019.06.25 |
구글맵 API document (0) | 2019.06.25 |
구글 아이콘 무료 사용 가능 (0) | 2019.06.24 |