Translations:Android Training/Building a Simple User Interface/15/en

From Android Wiki
Revision as of 03:24, 18 December 2015 by FuzzyBot (talk | contribs) (FuzzyBot verschob die Seite Translations:Android Training/Eine einfache Benutzeroberfläche erstellen/15/en nach Translations:Android Training/Building a Simple User Interface/15/en, ohne dabei eine Weiterleitung anzulegen: Teil der übersetzba…)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

android:id[edit source]

This provides a unique identifier for the view, which you can use to reference the object from your app code, such as to read and manipulate the object (you'll see this in the next lesson). The at sign (@) is required when you're referring to any resource object from XML. It is followed by the resource type (id in this case), a slash, then the resource name (edit_message). The plus sign (+) before the resource type is needed only when you're defining a resource ID for the first time. When you compile the app, the SDK tools use the ID name to create a new resource ID in your project's gen/ file that refers to the EditText element. With the resource ID declared once this way, other references to the ID do not need the plus sign. Using the plus sign is necessary only when specifying a new resource ID and not needed for concrete resources such as strings or layouts. See the sidebox for more information about resource objects.