Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在xml中设置mapfragment参数_Android_Xml_Layout - Fatal编程技术网

Android 在xml中设置mapfragment参数

Android 在xml中设置mapfragment参数,android,xml,layout,Android,Xml,Layout,我在初始化xml文件中的MapFragment时遇到了一个问题,我不明白为什么它以一种方式工作,而不是另一种方式 在开发过程中,我首先在我的主要活动中只有一个MapFragment。这很好: <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/map" android:

我在初始化xml文件中的MapFragment时遇到了一个问题,我不明白为什么它以一种方式工作,而不是另一种方式

在开发过程中,我首先在我的主要活动中只有一个MapFragment。这很好:

<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:cameraTargetLat="22.320542"
map:cameraTargetLng="114.185715"
map:mapType="normal"
map:cameraZoom="11"
/>

现在我已经找到了从代码中设置映射选项的方法,比如和-这并不是这里真正的问题。这不是我希望解决问题的方法,但可以接受。我主要是想理解为什么第二种方法不起作用?地图名称空间是在开始时声明的,同时还有android名称空间,显然整个xml中都存在该名称空间。

这看起来像是工具中的一个bug。我已经存档了。您可能想启动它,或者安排跟踪它,看看它是否真的是一个bug,它是否得到了修复,等等。

看起来像Eclipse中的bug-通过清理和重建项目来解决。

什么是“被Eclipse拒绝”的具体含义?我尝试添加地图:。。。元素和Eclipse告诉我“为标记片段找到了意外的名称空间前缀”映射”,所以我的项目不会生成。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

<ProgressBar
    android:id="@+id/progressBar1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<TableLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/current" />

        <TextView
            android:id="@+id/textCurrent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/forecast" />

        <TextView
            android:id="@+id/textForecast"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </TableRow>
</TableLayout>

</LinearLayout>
<fragment 
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment"
/>   
</LinearLayout>