[英]! Error. The file name must end with xml
I'm a beginning developer.我是一个初级开发者。 I have googled this problem and searched in stackoverflow.
我用谷歌搜索了这个问题并在stackoverflow中搜索。 Although there were some similar questions answered my specific problem.
虽然有一些类似的问题回答了我的具体问题。 Here is the code that's getting this error
这是出现此错误的代码
<?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>
You're receiving this error because a resource file is not ending with .xml .您收到此错误是因为资源文件未以.xml结尾。
Probably this ImageView
可能是这个
ImageView
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/ImageView"
android:background="@drawable/black"
/>
is causing this issue.导致这个问题。
Make sure that your drawable file black
is called black.xml and not only black .确保您的可绘制文件
black
被称为black.xml而不仅仅是black 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.