代码之家  ›  专栏  ›  技术社区  ›  Max Jones

与元素类型“ListView”关联的属性“android:id”的前缀“android”未绑定

  •  0
  • Max Jones  · 技术社区  · 11 年前

    我一直犯这个错误

    与元素类型“ListView”关联的属性“android:id”的前缀“android”未绑定。

    错误所在的代码位

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:choiceMode="singleChoice">
    </ListView>
    

    当这个代码在flex中不处于第一个veew状态时,它就可以工作了。如果我创建另一个组件,代码就可以工作。但我需要它在主视图中显示id引用的项目列表,但一直说未定义状态

    `

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <s:List
            android:id="@+id/Games"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
        </s:List>
        </LinearLayout>
    

    `

    1 回复  |  直到 9 年前
        1
  •  0
  •   Superlandero    11 年前

    我认为你应该将@android:id/list更改为@+id/list

    <ListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:choiceMode="singleChoice">
    </ListView>
    

    这应该有效!