有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Android Eclipse错误:在包中找不到属性“layout_column”的资源标识符

我面临着一个破坏我整个项目的错误:

error: No resource identifier found for attribute 'layout_column' in package

这是我在项目中遇到的第一个错误。好吧,一开始它并没有困扰我,但随着我继续我的项目,它变得更加突出。当我开始使用findViewById定义应用程序中的对象时,我注意到没有出现自动建议,如果这是错误的,请纠正我:

TextView Name = (TextView)findViewById(R.id.NameLabel);
TextView Surname = (TextView)findViewById(R.id.SurnameLabel);
TextView Profession = (TextView)findViewById(R.id.ProfessionLabel);
TextView Contacts = (TextView)findViewById(R.id.ContactLabel);

我得到的错误是,尽管添加了标签并再次检查了布局中的名称,但无法解析标签或字段,但没有。我在网上搜索,发现也不会有自动回复,因为我没有保存它,我知道我当时已经保存了。所以XML文件有点问题:是的

在网上查看了这么多解决方案,但没有一个有效(除非我做得不对),但没有一个是针对我的问题的。所以我想——“你知道吗,我为什么不把它清理一下作为最后的手段呢?”我做到了,这让事情变得更糟,现在R不能被解析,或者作为一个字段,主屏幕中的activity_main_屏幕也是如此。java文件。我独立地搜索了可能导致这些错误的原因,得到了相同的响应,XML文件有问题:。。。是的

请帮助我,因为xml文件,我现在面临9个错误,有什么问题吗???以下是我的xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:app="http://schemas.安卓.com/apk/res/com.DenzDevAppz.cardbeta"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:id="@+id/MainApp"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:orientation="vertical" >

<TextView
    安卓:id="@+id/MainLabel"
    安卓:layout_width="wrap_content"
    安卓:layout_height="wrap_content"
    安卓:layout_marginBottom="10dp"
    安卓:layout_marginLeft="10dp"
    安卓:layout_marginRight="10dp"
    安卓:layout_marginTop="10dp"
    安卓:text="Contact"
    安卓:textColor="#000000"
    安卓:textSize="20sp"
    tools:ignore="HardcodedText" />

<LinearLayout
    安卓:layout_width="match_parent"
    安卓:layout_height="wrap_content" >

    <GridLayout
        安卓:layout_width="224dp"
        安卓:layout_height="wrap_content"
        安卓:layout_margin="5dp"
        安卓:layout_weight="0.03"
        安卓:columnCount="2"
        安卓:columnOrderPreserved="true"
        安卓:rowCount="9"
        安卓:rowOrderPreserved="true" >

        <TextView             <------------(error)
            安卓:id="@+id/ProfessionLabel"
            安卓:layout_width="84dp"
            安卓:layout_height="wrap_content"
            安卓:layout_column="0"
            安卓:layout_gravity="left|top"
            安卓:layout_row="1"
            app:layout_column="0"
            app:layout_gravity="left|top"
            app:layout_row="2"
            安卓:text="Profession:"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/NameLabel"
            安卓:layout_width="84dp"
            安卓:layout_height="wrap_content"
            安卓:layout_column="0"
            安卓:layout_gravity="left|top"
            安卓:layout_row="0"
            app:layout_column="0"
            app:layout_gravity="left|top"
            app:layout_row="0"
            安卓:text="Name:"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/BusinessLabel"
            安卓:layout_width="84dp"
            安卓:layout_height="wrap_content"
            安卓:layout_column="0"
            安卓:layout_gravity="left|top"
            安卓:layout_row="2"
            app:layout_column="0"
            app:layout_gravity="left|top"
            app:layout_row="4"
            安卓:text="Business:"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/LocationLabel"
            安卓:layout_width="84dp"
            安卓:layout_height="wrap_content"
            安卓:layout_column="0"
            安卓:layout_gravity="left|top"
            安卓:layout_row="3"
            app:layout_column="0"
            app:layout_gravity="left|top"
            app:layout_row="5"
            安卓:text="Location:"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/NameDataRetreiver"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="0"
            app:layout_column="1"
            app:layout_gravity="left|top"
            app:layout_row="0"
            安卓:text="None"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/SurnameDataRetrevier"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="1"
            app:layout_column="1"
            app:layout_gravity="left|top"
            app:layout_row="2"
            安卓:text="None"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/BusinessDataRetreiver"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="2"
            app:layout_column="1"
            app:layout_gravity="left|top"
            app:layout_row="4"
            安卓:text="None"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/LocationDataRetreiver"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="3"
            app:layout_gravity="left|top"
            安卓:text="None"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/ContactsLabel"
            安卓:layout_width="84dp"
            安卓:layout_height="wrap_content"
            安卓:layout_column="0"
            安卓:layout_gravity="center_horizontal|top"
            安卓:layout_row="4"
            app:layout_column="0"
            app:layout_gravity="left|top"
            app:layout_row="7"
            安卓:text="Contacts:"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/ContactDataRetrevL2"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="4"
            app:layout_column="1"
            app:layout_gravity="left|top"
            app:layout_row="8"
            安卓:text="--------------------"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/ContactDataRetrevL3"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="5"
            app:layout_column="1"
            app:layout_gravity="left|top"
            app:layout_row="9"
            安卓:text="--------------------"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/ContactDataRetrevL4"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="6"
            app:layout_column="1"
            app:layout_gravity="left|top"
            app:layout_row="10"
            安卓:text="---------------------"
            tools:ignore="HardcodedText" />

        <TextView
            安卓:id="@+id/ContactDataRetrevL1"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_column="1"
            安卓:layout_gravity="left|top"
            安卓:layout_row="7"
            app:layout_column="1"
            app:layout_gravity="left|top"
            app:layout_row="7"
            安卓:text="--------------------"
            tools:ignore="HardcodedText" />
    </GridLayout>

    <Gallery
        安卓:id="@+id/Card_Holder"
        安卓:layout_width="158dp"
        安卓:layout_height="match_parent"
        安卓:layout_margin="5dp"
        安卓:layout_weight="0.17"
        安卓:background="#C0C0C0" />
</LinearLayout>

<LinearLayout
    安卓:layout_width="match_parent"
    安卓:layout_height="48dp" >

    <TextView
        安卓:id="@+id/textView1"
        安卓:layout_width="wrap_content"
        安卓:layout_height="match_parent"
        安卓:layout_marginBottom="15dp"
        安卓:layout_marginLeft="5dp"
        安卓:layout_marginRight="5dp"
        安卓:layout_marginTop="15dp"
        安卓:layout_weight="0.73"
        app:layout_column="0"
        app:layout_gravity="left|center_vertical"
        app:layout_row="0"
        安卓:text="What would you like to do?" />

    <ScrollView
        安卓:id="@+id/scrollView1"
        安卓:layout_width="269dp"
        安卓:layout_height="wrap_content" >

        <LinearLayout
            安卓:layout_width="match_parent"
            安卓:layout_height="188dp"
            安卓:orientation="vertical" >

            <Button
                安卓:id="@+id/ImportContactButton"
                安卓:layout_width="266dp"
                安卓:layout_height="wrap_content"
                安卓:enabled="true"
                安卓:text="Add/Import Contact" />

            <Button
                安卓:id="@+id/DeleteContactButton"
                安卓:layout_width="266dp"
                安卓:layout_height="wrap_content"
                安卓:enabled="false"
                安卓:text="Delete Contact" />

            <Button
                安卓:id="@+id/ViewContactButton"
                安卓:layout_width="266dp"
                安卓:layout_height="wrap_content"
                安卓:enabled="false"
                安卓:text="View Contact" />

            <Button
                安卓:id="@+id/ContactBusinessButton"
                安卓:layout_width="266dp"
                安卓:layout_height="wrap_content"
                安卓:enabled="false"
                安卓:text="Contact Business/Card" />
        </LinearLayout>
    </ScrollView>
</LinearLayout>

请帮忙,如果你有任何建议,非常感谢。由于我的最后期限即将在本周末,非常感谢你的回复

谢谢

如果你对其他错误感兴趣,这里有:

SurnameLabel cannot be resolved or is not a field -MainScreen.java -Java Problem ProfessionLabel cannot be resolved or is not a field -MainScreen.java -Java Problem NameLabel cannot be resolved or is not a field -MainScreen.java -Java Problem activity_main_screen cannot be resolved or is not a field -MainScreen.java -Java Problem ContactLabel cannot be resolved or is not a field -MainScreen.java -Java Problem action_settings cannot be resolved or is not a field -MainScreen.java -Java Problem main_screen cannot be resolved or is not a field -MainScreen.java -Java Problem ||||| error: No resource identifier found for attribute 'layout_column' in package -Android AAPT Problem

非常感谢


共 (0) 个答案