“Cannot Resolve Symbol” Error when using android:id=“@+android:id/my_id”

后端 未结 3 740
借酒劲吻你
借酒劲吻你 2021-02-18 23:11

When I am adding android:id/background to the namespace, Lint complains that it \"Cannot Resolve Symbol\" even though I am requesting to add it rather than call it. The code wor

相关标签:
3条回答
  • 2021-02-18 23:22

    If you are creating your own id:

    "@+id/your_new_id"
    

    if you are accessing your already created id

    "@id/your_old_id"
    

    if you are trying to access Android's system created id

    "@android:id/system_id"
    

    you can see the difference, if you are creating your own id then you have to add +. Since you are accessing system ID so you don't have to add +

    0 讨论(0)
  • 2021-02-18 23:24

    It seems you are using an extra +.

    You should remove it, replace as follows @+android:id/background to @android:id/background.

    0 讨论(0)
  • 2021-02-18 23:27

    Try to replace @+android:id by @+id and see if it works!

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