属性缺少特定于android的命名空间

Dha*_*tri 1 eclipse android

这是main.xml的片段.尽管使用了android:layout_width,但它的given属性却丢失了.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical" 
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <TextView android:id="@+id/eventlabel" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10px" 
        android:layout_weight="1" 
        android:paddingBottom="10px"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

有人能指出错误吗?谢谢

Rag*_*ood 5

你有:

<LinearLayout xmlns="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools
Run Code Online (Sandbox Code Playgroud)

将其更改为:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    <!-- rest is the same -->
Run Code Online (Sandbox Code Playgroud)

您只有xmlns=...并且实际上没有指定android它的一部分.此外,您的toolsXMLNS错过了结束"