类型错误:未在包中找到属性“layout_alignparentleft”的资源标识符

时间:2014-05-31 14:40:27

标签: android xml

嗨我一直收到这个错误并且没有找到解决方案。我已经改变了Api级别,然后为构建目标做了同样的事情。我不知道这里有什么问题。请帮助。

        android:minSdkVersion="14"
       android:targetSdkVersion="18"

list_item.xml文件

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <textview
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignparentleft="true"
        android:layout_alignparenttop="true"
        android:layout_marginleft="26dp"
        android:layout_margintop="23dp"
        android:text="Medium Text"
        android:textappearance="?android:attr/textAppearanceMedium" >
    </textview>

</relativelayout>

这是主要的xml文件

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Main" >

    <listview
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignparentleft="true"
        android:layout_alignparenttop="true" >
    </listview>

</relativelayout>

我收到这些错误

error: No resource identifier found for attribute 'layout_alignparenttop' in package 'android'
error: No resource identifier found for attribute 'layout_alignparenttop' in package 'android'
error: No resource identifier found for attribute 'layout_margintop' in package 'android'   
error: No resource identifier found for attribute 'layout_alignparentleft' in package 'android'
error: No resource identifier found for attribute 'textappearance' in package 'android' list_item.xml
error: No resource identifier found for attribute 'layout_alignparentleft' in package 'android' list_item.xml

1 个答案:

答案 0 :(得分:2)

<relativelayout>中的错误XML。它应该是<RelativeLayout>

查看Relative Layout

同样更正textviewTextViewlistviewListView @Aldo Borrero的评论