2014-06-15 6 views
0

MapFragment를 RelativeLayout에 배치하려고합니다. 문제는 다른 네임 스페이스에 속한 zOrderOnTop과 같은 사용자 지정 특성을 사용해야한다는 것입니다.레이아웃 xml의 중첩 네임 스페이스

루트 요소 다 괜찮으로 나는 조각을 넣으면 : "

<fragment 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:map="http://schemas.android.com/apk/res-auto" 
    class="com.mycompany.testproj.CustomMapFragment" 
    android:id="@+id/mapView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:clickable="true" 
    android:layout_margin="40dp" 
    map:zOrderOnTop="true" 
    android:background="#00000000" 
/> 

그러나 RelativeLayout의 내부에 조각을 넣어하려고 할 때 나는 오류를 태그에 발견

예기치 않은 네임 스페이스 접두사 '의 xmlns"를 얻을 조각 "

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 

    <fragment 
     xmlns:map="http://schemas.android.com/apk/res-auto" 
     class="com.mycompany.testproj.CustomMapFragment" 
     android:id="@+id/mapView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:clickable="true" 
     android:layout_margin="40dp" 
     map:zOrderOnTop="true" 
     android:background="#00000000" 
    /> 
</RelativeLayout> 

답변

0

나는 내 문제 나 해결했습니다 Y 사용 inlude :

map_view.xml :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 


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

</RelativeLayout> 

map_fragment.xml

<fragment 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:map="http://schemas.android.com/apk/res-auto" 
    class="com.mycompany.testproj.CustomMapFragment" 
    android:id="@+id/mapView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:clickable="true" 
    android:layout_margin="40dp" 
    map:zOrderOnTop="true" 
    android:background="#00000000" 
/> 
관련 문제