【发布时间】:2013-09-25 02:50:15
【问题描述】:
我不确定为什么会收到“文档中根元素之后的标记必须格式正确”。我试图在 android 项目的 res/menu 下的 mainxml 中使用以下代码。请帮忙!!!
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|left"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
style="@style/inputLabel"
android:text="@string/cardHolderName" />
<EditText
android:id="@+id/cardHolderNameInput"
style="@style/textInput"
android:layout_width="fill_parent"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
style="@style/inputLabel"
android:text="@string/cardNumber" />
<EditText
android:id="@+id/cardNumberInput"
style="@style/textInput"
android:layout_width="fill_parent"
android:numeric="integer"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
style="@style/inputLabel"
android:paddingRight="40sp"
android:text="@string/expirationDate" />
<TextView
style="@style/inputLabel"
android:text="@string/expirationMonth" />
<EditText
android:id="@+id/expirationMonthInput"
style="@style/textInput"
android:layout_width="50sp"
android:numeric="integer"
android:singleLine="true" />
<TextView
style="@style/inputLabel"
android:paddingLeft="10sp"
android:text="@string/expirationYear" />
<EditText
android:id="@+id/expirationYearInput"
style="@style/textInput"
android:layout_width="50sp"
android:numeric="integer"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
style="@style/inputLabel"
android:text="@string/cvv" />
<EditText
android:id="@+id/cvvInput"
style="@style/textInput"
android:layout_width="fill_parent"
android:numeric="integer"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
style="@style/inputLabel"
android:text="@string/amount" />
<EditText
android:id="@+id/amountInput"
style="@style/textInput"
android:layout_width="fill_parent"
android:numeric="integer|decimal"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="@+id/submitAction"
style="@style/action"
android:clickable="true"
android:text="@string/submit" />
</LinearLayout>
</LinearLayout>
</ScrollView>
任何帮助将不胜感激。谢谢。
【问题讨论】:
-
这是你的 xml 中唯一的东西吗?发布 xml 文档的全部内容。还有文件在哪里,文件名是什么?
-
对我来说看起来不错。你试过清理你的项目吗?或者复制文件的内容。删除文件并重新制作,然后将其粘贴回那里可能会解决问题。
-
对不起,文件名为main.xml,在android项目的res/menu文件夹下。
-
在我的回答中,这是一个布局文件而不是菜单