1. Download our Official Android App: Forums for Android!

Apps Understanding xml properties

Discussion in 'Android Development' started by mvmd, Jun 9, 2011.

  1. mvmd

    mvmd Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Jun 9, 2011

    Jun 9, 2011
    3
    0
    5
    So I'm obviously new to developing for droid, as well as Java, and as I'm following along through tutorials I see in the xml for a textview for example:

    HTML:
    1. android:id="@+id/label"
    What I'm wondering about, is there a specific reason there's a '+' infront of id?
     

    Advertisement

  2. miXer

    miXer Android Enthusiast
    Rank:
    None
    Points:
    53
    Posts:
    313
    Joined:
    Aug 12, 2010

    Aug 12, 2010
    313
    51
    53
    Norway
    The + is there to add the id to the auto generated R file. If you take the + away, you would have to manually go into the auto generated file(you hear it sounds bad) and add it yourself.
     
    mvmd likes this.
  3. AndroidLab

    AndroidLab Lurker
    Rank:
    None
    Points:
    5
    Posts:
    5
    Joined:
    Jun 6, 2011

    @+id means that you are creating this ID, @id means that you're invoking and id that already exists.
     
  4. mvmd

    mvmd Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Jun 9, 2011

    Jun 9, 2011
    3
    0
    5
    Makes sense, thanks.
     

Share This Page

Loading...