2013-09-25 4 views
0

Я не уверен, почему я получаю «Разметка в документе, следующая за корневым элементом, должна быть хорошо сформирована». Я пытался использовать следующий код в mainxml под res/menu в проекте android. Поможи Плесе !!!XML-документ не очень хорошо сформирован

<?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> 

Любая помощь будет оценена по достоинству. Благодарю.

+0

Это единственное, что есть в вашем xml? Опубликуйте все содержимое документа xml. Также где находится файл и что такое имя файла? – nedaRM

+0

Выглядит хорошо. Попробовали ли вы очистить свой проект? Или скопируйте содержимое файла. Удалите файл и переделайте его, а затем вставьте обратно, чтобы устранить проблему. – nedaRM

+0

Извините, имя файла main.xml, находящееся под папкой res/menu в проекте android. – DataEnthusiastic

ответ

4

У вас не может быть файл макета под res/menu. Переместите файл main.xml в res/layout, и все должно быть хорошо.

1

Скорее всего, у вас есть незакрытые элементы или они не включены в пространство имен android. Пожалуйста, опубликуйте весь документ xml для дальнейшего уточнения.

Редактировать: Вы разместили свой xml под меню, а не под макетом.

Смежные вопросы