What does “@+id” mean?

前端 未结 4 660
渐次进展
渐次进展 2021-02-01 23:02

I\'ve read through much of the Android documentation and I\'ve yet to find any statement that says what an id value prefix of \"@+id\" means. I know what \"@string\" and variat

4条回答
  •  失恋的感觉
    2021-02-01 23:31

    The plus sign simply indicates that the ID should be created if it doesn't exist.

    It's common practice to use @+id/foo when defining a new View in a layout, and then use @id/foo to reference the View from another part of the layout (say, in a RelativeLayout hierarchy) or R.id.foo to reference it from code.


    UPDATE: Docs are here: Declaring Layout - Attributes - ID

提交回复
热议问题