android:id what is the plus sign for

后端 未结 2 1579
南笙
南笙 2021-02-04 23:47

The document says \"@[+]id/myid\" as the definition for android:id, from the notation it indicates that the plus is optional. But nowhere can I find a definition of what the plu

2条回答
  •  孤独总比滥情好
    2021-02-05 00:33

    @+id/foo means you are creating an id named foo in the namespace of your application. You can refer to it using @id/foo. @android:id/foo means you are referring to an id defined in the android namespace. This namespace is the namespace of the framework. In this case, you need to use @android:id/list and @android:id/empty because these are the id the framework expects to find (the framework knows only about the ids in the android namespace.)

    Taken from one of the "Android Developer | Google Groups" discussions.

提交回复
热议问题