2012-09-18 26 views
0

下面是關於我遇到的錯誤的屏幕截圖基本Android XML錯誤

我該如何解決這個問題?

error

我真的很感激一些幫助

這是XML代碼:

<?xml​version="1.0" ​encoding="utf-8"?> 
    <LinearLayout​xmlns:android="http://schemas.android.com/apk/res/android" 
​​​ android:orientation="vertical" 
​​​​ android:layout_width="fill_parent" 
​​​ ​android:layout_height="fill_parent"​> 
    <TextView​​ 
​​​​ android:layout_width="fill_parent"​ 
​​​​ android:layout_height="wrap_content"​ 
​​​​ android:text="@string/hello"​/> 
​​​​ 
    <TextView 
​​​​ android:layout_width="fill_parent" 
​​​​ android:layout_height="wrap_content" 
​​​​ android:text="This is my first Android Application!" /> 
    <Button 
​​​​ android:layout_width="fill_parent" 
​​​​ android:layout_height="wrap_content" 
​​​​ android:text="And this is a clickable button!" /> 
​​​​ 
    </LinearLayout> 
+0

XML中的第一個元素被錯誤覆蓋。你能否將XML複製到你的問題中? – MCeley

+0

是的,它看起來很好,你有沒有在R文件中玩過?也許只是在這裏複製粘貼代碼,並沒有錯誤掩蓋它:) –

+0

@MCeley <?xml version =「1.0」encoding =「utf-8」?>是涉及的XML – Anant

回答

3

我相信沒有在Strings.xml名爲 「你好」 的字符串(在水庫>值)。

請檢查,可能這應該可以解決您的問題。

+0

是的!解決它。謝謝噸:D – Anant

3
LinearLayout​xmlns:android="http://schemas.android.com/apk/res/android" 

有待

LinearLayout ​xmlns:android="http://schemas.android.com/apk/res/android" 

如果沒有水療中心ce,第一個XML標籤是無效的。

完整的XML是:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hello" /> 

    <TextView android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="This is my first Android Application!" /> 

    <Button android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="And this is a clickable button!" /> 

</LinearLayout> 
+0

不幸的是,它仍然給我錯誤 – Anant

+0

現在就試試吧。出於某種原因,如果我複製並粘貼了XML,它將不起作用。但是,如果我完全鍵入它自己,那麼它就可以工作。我認爲無論它最初粘貼到哪裏都可能有問題。 – MCeley

+1

我使用十六進制編輯器查看了複製和粘貼的文本,並且有些字符無效,因此它似乎是複製字符的編碼問題。如果你從我的帖子中複製並粘貼XML,它應該可以工作。 – MCeley