[英]LinearLayout XML error 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>
這是一個非常不言自明的錯誤消息。
您沒有關閉LinearLayout
標簽。 在android:orientation="vertical"
之后添加一個>
。
您在末尾錯過了一個“>”:
<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標簽沒有關閉。 在其末尾添加一個>
,如下所示:
<?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"
/>
要么
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.