When should i use @android:id/?

前端 未结 3 1210
无人及你
无人及你 2021-01-16 08:12

I\'ve found some code examples with the @android:id/xyz attribute set instead of @+id/xyz.
When and why is it necessary to use Android ids in

相关标签:
3条回答
  • 2021-01-16 08:45

    @android:id indicates that the id is in the Android.r.id namespace. So this is useful for ListActivities where they look for Android.r.id.list by default.

    0 讨论(0)
  • 2021-01-16 08:55

    The plus-symbol means that the resource is new and it must be created and added to the resources in the R.java file.

    Omitting the plus symbol references an already existing resource.

    0 讨论(0)
  • 2021-01-16 08:56

    @android is used to access the default resources of Android . For example see this:

    android:background="@android:color/transparent"
    

    Using + sign means this resource must be added in R.java file while not using + sign means the resource already exist in R.java.

    0 讨论(0)
提交回复
热议问题