无法检索图形布局

时间:2014-09-16 12:44:09

标签: android xml eclipse android-layout

这是我的activity_main.xml。 当我尝试切换到图形视图时,它会从“片段布局”菜单中选择一个片段。

另外,按钮和微调器都没有显示在我的布局中!!!!!

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

  <Spinner
    android:id="@+id/spr_place_type"
    android:layout_width="wrap_content"
    android:layout_height="60dp"
    android:layout_alignParentTop="true"  />

  <Button
     android:id="@+id/btn_find"
    android:layout_width="wrap_content"
    android:layout_height="60dp"
    android:layout_alignParentTop="true"
    android:layout_toRightOf="@id/spr_place_type"
    android:text="@string/str_btn_find" />

  <fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/map"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/spr_place_type"
    class="com.google.android.gms.maps.SupportMapFragment" />

  </RelativeLayout>

任何人都可以为我解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

删除片段命名空间。

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

答案 1 :(得分:0)

是的,这只是图形布局编辑器的信息,应该如何在编辑器中显示片段。

尝试删除

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

并尝试

相关问题