본문 바로가기

Programming/Android

[Android] 툴바(Toolbar)와 맵뷰(MapView) 사용시 지도가 정상적으로 표시되지 않는 문제

툴바와 맵뷰를 같이 사용하게 되면 맵뷰 화면이 정상적으로 렌더링이 되지 않는다.


맵뷰 플래그먼트가 자리를 제대로 잡지 못해서 생기는 현상으로 보이는데, 아래와 같이.. 레이아웃을 잡아주면 된다.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<include
layout="@layout/toolbar"/>

<FrameLayout
android:id="@+id/layout_content"
android:layout_below="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"></FrameLayout>

</RelativeLayout> 



이코드의 핵심은 android:layout_below="@+id/toolbar"


툴바의 아이디를 써주게 되면 맵이 정상적으로 표시되게 된다..