2013-04-29 59 views
0

我試圖解決這個如此糟糕,但我無法找到我出錯的地方。LinearLayout XML錯誤Android

消息:

Element type "LinearLayout" must be followed by either attribute specifications, ">" or "/>". 

爲什麼會這樣?有任何想法嗎?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:weightSum="100" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 

    **<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_weight="70" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:background="#0000FF" 
     android:padding="20dp" 
     android:paddingBottom="10dp" 
     android:gravity="center_horizontal"> 



    </LinearLayout> 


</LinearLayout> 

回答

2

你在最後錯過了 「>」:

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

這是一個不言自明的錯誤消息。

您沒有關閉您的LinearLayout標記。在android:orientation="vertical"之後添加>

2

您的第一個LinearLayout標籤未關閉。添加一個>到它的末尾,像這樣:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:weightSum="100" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

           ^
-1

錯誤清楚地表明您錯過了結束標記。每個佈局及其屬性都需要有自己的開始和結束標記。添加

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_weight="70" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
/> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_weight="70" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

</LinearLayout> 
+0

他有兩個他的結束標記。他只是錯過了第一個LinearLayout的結束角度支架。 – LukeWaggoner 2015-08-21 22:51:31