2013-09-07 2 views
4

Google지도로 간단한 Android 앱을 만들고 있습니다. 나는이 레이아웃을했습니다 :Android의 Xml 속성 AndroidStudio에서 Google지도가 작동하지 않습니다.

<?xml version="1.0" encoding="utf-8"?> 

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
android:orientation="vertical" android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:id="@+id/root" 
android:background="@android:color/transparent"> 

<fragment 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:name="com.google.android.gms.maps.MapFragment" 
    android:id="@+id/map2" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    map:cameraBearing="112.5" 
    map:cameraTargetLat="45.438122" 
    map:cameraTargetLng="12.318221" 
    map:cameraTilt="30" 
    map:cameraZoom="18" 
    map:mapType="normal" 
    map:uiCompass="false" 
    map:uiRotateGestures="true" 
    map:uiScrollGestures="true" 
    map:uiTiltGestures="false" 
    map:uiZoomControls="true" 
    map:uiZoomGestures="true" 
    /> 

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageView" 
    android:src="@drawable/map" 
    android:layout_gravity="left|top" 
    android:layout_alignParentLeft="false" 
    android:layout_alignParentTop="false" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" /> 
</FrameLayout> 

말해 안드로이드 스튜디오 :

Unexpected namespace prefix "map" found for tag fragment 

를하고 코드가 나에게 좋아 보이지도 경우 오류와 같은 "지도"를 접두어 모든 행을 표시합니다. 내 앱 배치 중 Android 기기에서 모든지도 태그가 작동하고 있음을 알 수 있습니다.

AndroidStudio의 작은 버그 일뿐입니다.

약간의 호기심 : <fragment> 네임 스페이스로 아래 수행 나던 당신의 <FrameLayout> 요소에

<?xml version="1.0" encoding="utf-8"?> 
<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
android:id="@+id/map" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
class="com.google.android.gms.maps.SupportMapFragment" 
map:cameraBearing="112.5" 
map:cameraTargetLat="45.438122" 
map:cameraTargetLng="12.318221" 
map:cameraTilt="30" 
map:cameraZoom="18" 
map:mapType="normal" 
map:uiCompass="false" 
map:uiRotateGestures="true" 
map:uiScrollGestures="true" 
map:uiTiltGestures="false" 
map:uiZoomControls="true" 
map:uiZoomGestures="true" 
/> 
+0

build.gradle에 'com.google.android.gms : play-services : 3.2.25'를 컴파일 했습니까? – pumpkee

+0

예. 내가 반복, 애플 리케이션 문제없이 잘 작동합니다. Android Studio에서만 문제가되는 것 같습니다. – drenda

답변

0

그것은 xmlns:map="http://schemas.android.com/apk/res-auto" 네임 스페이스 선언처럼 보인다 :이 레이아웃을 사용하는 대신 안드로이드 스튜디오는 오류를 표시하지 않습니다. 두 번째 예제는 그것을 사용하는 요소 내에 네임 스페이스 선언을 가지고 있으며 (<fragment>) Android Studio는 즉시이를 인식합니다.

관련 문제