0

私は Google Maps API を使用しており、Google Maps の初期状態を XML で構成しようとしています。

XML コード全体:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/test_bg"
android:scaleType="centerCrop"/>

<RelativeLayout 
   android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent" >    


<RelativeLayout 
    android:id="@+id/navigation_top"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="5dp" >

    <!-- android:src="@drawable/button_back_src"    android:background="@drawable/button_background"
    android:background="@drawable/test_btn_background"-->
    <ImageButton 
        android:id="@+id/button_back"
        android:layout_width="58dp"
        android:layout_height="58dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:contentDescription="@string/desc_top_button_back"

        android:background="@drawable/btn_back"
        android:scaleType="fitXY"
        android:layout_marginRight="0dp"
        android:layout_marginLeft="@dimen/standard_margin"  
        android:layout_marginTop="@dimen/standard_margin"
        android:layout_marginBottom="0dp"
          />


    <!-- android:background="@drawable/button_background" android:background="@drawable/test_btn_background" android:src="@drawable/button_options_src"-->
    <ImageButton 
        android:id="@+id/button_options"
        android:layout_width="58dp"
        android:layout_height="58dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"

        android:contentDescription="@string/desc_top_button_options"
        android:background="@drawable/btn_options"
        android:scaleType="fitXY"
        android:layout_marginRight="@dimen/standard_margin"
        android:layout_marginLeft="0dp"  
        android:layout_marginTop="@dimen/standard_margin"
        android:layout_marginBottom="0dp" />


    <!-- background, android:dropDownSelector="@drawable/spinner_selector_small"  -->
    <Spinner 
        android:id="@+id/spinner"
        android:layout_height="58dp"
        android:layout_width="wrap_content"
        android:layout_toLeftOf="@+id/button_options"
        android:layout_toRightOf="@+id/button_back"
        android:spinnerStyle="@android:style/Widget.Spinner.DropDown"
        android:background="@drawable/test_spinner_style"   
        android:padding="5dp"
        android:layout_marginRight="0dp"
        android:layout_marginLeft="0dp"  
        android:layout_marginTop="5dp"
        android:layout_marginBottom="0dp" />

</RelativeLayout>

    <LinearLayout 
        android:id="@+id/layout_checkpoints"

        android:minHeight="24dp"
        android:layout_below="@+id/navigation_top"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:background="@android:color/transparent">

    </LinearLayout>

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignTop="@+id/layout_checkpoints"
    android:layout_centerHorizontal="true"
    class="com.google.android.gms.maps.SupportMapFragment"
    android:layout_marginLeft="@dimen/double_margin"
    android:layout_marginRight="@dimen/double_margin"
    android:layout_marginBottom="68dp" />

<LinearLayout
    android:id="@+id/rounded_corners_for_map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignBottom="@+id/map"
    android:layout_alignLeft="@+id/map"
    android:layout_alignRight="@+id/map"
    android:layout_below="@+id/navigation_top"
    android:background="@drawable/round_corners"
    android:orientation="horizontal" >

</LinearLayout>

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:scaleType="fitXY" 
    android:src="@drawable/splash" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:id="@+id/splash_screen" 
    android:layout_alignParentBottom="true"/>

ご覧のとおり、追加しました

xmlns:map="http://schemas.android.com/apk/res-auto"

最初に FramLayout に。ただし、マッププレフィックスを使用しようとすると、許可されません。

私はこのようにしようとしています:

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignTop="@+id/layout_checkpoints"
    android:layout_centerHorizontal="true"
    class="com.google.android.gms.maps.SupportMapFragment"
    android:layout_marginLeft="@dimen/double_margin"
    android:layout_marginRight="@dimen/double_margin"
    android:layout_marginBottom="68dp"
    map:uiZoomControls="false" />

ただし、 map:uiZoomControls="false" に下線が引かれ、Unexpected namespace prefix "map" などと表示されます。

私は何が間違っているのですか?

4

1 に答える 1