2016-09-24 51 views
-5

我是一名開始開發者。我搜索了這個問題,並在stackoverflow搜索。雖然有一些類似的問題回答了我的具體問題。 下面是就可能遇到這個錯誤!錯誤。文件名必須以xml結尾

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    tools:context="com.example.android.happy18thbirthdayzane.MainActivity"> 


     <ImageView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:id="@+id/ImageView" 
     android:background="@drawable/black" 
     /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingBottom="150dp" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="Happy 18th Birthday!" 
     android:textStyle="bold" 
     android:textColor="#d3a625" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     /> 

    <TextView 
     android:id="@+id/textView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingTop="150dp" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="Dear Zane" 
     android:textStyle="bold" 
     android:textColor="#d3a625" 
     android:layout_centerHorizontal="true" 
     android:inputType="text" /> 

</RelativeLayout> 
+1

包含此XML的文件的名稱是什麼? – Egor

回答

0

你收到此錯誤,因爲一個資源文件不與.XML結束的代碼。

也許這ImageView

<ImageView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/ImageView" 
    android:background="@drawable/black" 
    /> 

引起此問題。

確保您的繪製文件black稱爲black.xml不僅

相關問題