2013-07-27 29 views
1

我有以下XML文件:錯誤的xml文件

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/Scroll" 
    android:layout_width="match_parent"> 
    <RelativeLayout 
    android:id="@+id/contenedor" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <LinearLayout android:id="@+id/cabecera" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:orientation="vertical" 
     android:background="#CCCCFF" 
     > 

     <ImageView 
      android:id="@+id/icon" 
      android:src="@drawable/guliver" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
     /> 

    </LinearLayout> 

    <EditText android:id="@+id/edit_titulo_lugar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="100dp" 
     android:layout_marginLeft="50dp" 
     android:width="200dp" 
     android:hint="@string/titulo_lugar" 
     android:inputType="text" 
     /> 

    <EditText android:id="@+id/edit_descripcion_lugar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="170dp" 
     android:layout_marginLeft="50dp" 
     android:width="200dp" 
     android:hint="@string/descripcion_lugar" 
     android:inputType="text" 
     /> 

    <ImageButton 
      android:id="@+id/imgButton" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="260dp" 
      android:src="@drawable/camara1" 
     /> 

     <Button android:id="@+id/guardar" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/textedit" 
      android:text="@string/bguardar" 
      android:layout_marginTop="310dp" 
      android:layout_marginLeft="50dp" 
      /> 

     <Button android:id="@+id/cancelar" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/textedit" 
      android:text="@string/bcancelar" 
      android:layout_marginTop="310dp" 
      android:layout_marginLeft="200dp" 
      /> 

    </RelativeLayout> 
</ScrollView> 

當我嘗試運行應用程序我有錯誤: 錯誤解析XML:綁定前綴的滾動型標籤。

在互聯網搜索後,我發現這個問題的幾個答案,但我無法修復它。 我還輸入了

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

上面的ScrollView標籤,但錯誤仍然存​​在。我也刪除了xmlns字符串,但它不是解決方案。

怎麼了?

謝謝。

+1

你有沒有嘗試清潔項目? – peshkira

+0

是的。在清理該項目的三個意圖之後,最終確定了錯誤。 – axmug

+0

是「android:layout_below =」@ + id/textedit「導致您遇到問題嗎?我沒有在您提供的XML文件中看到名爲」textedit「的XML元素。 – Demitrian

回答

1

您還沒有指定屬性android:layout_heightScrollView元素:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/Scroll" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

</ScrollView> 
0

之前或之後android:layout_width只需添加

android:layout_height = "match_parent" 

ScrolView,你的問題應該消失。