错误:在'android'包中找不到属性'layout_toLeftof'的资源标识符

时间:2013-11-26 21:13:18

标签: android relativelayout

为什么我会收到此错误?

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        ...

        <EditText
            android:id="@+id/text_spent1"
            android:layout_width="100dp"
            android:layout_marginTop="20dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/groc_store"
            android:layout_centerInParent="true"
            android:hint="-"
            android:inputType="number"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toLeftof="@+id/text_spent1"
            android:layout_below="@+id/groc_store"
            android:text="Spent: $"
            />

        ...

    </RelativeLayout>

我也尝试了android:layout_toRightof但是我收到layout_toRightof属性的相同错误消息。我也尝试过使用"@id/text_spent1"

1 个答案:

答案 0 :(得分:0)

将其更改为

android:layout_toLeftOf="@+id/text_spent1"

Capital&#34; O&#34;

RelativeLayout.LayoutParams Docs