Книга: Beginning Android
What’s with the @ Signs?
What’s with the @ Signs?
Many widgets and containers only need to appear in the XML layout file and do not need to be referenced in your Java code. For example, a static label (TextView
) frequently only needs to be in the layout file to indicate where it should appear. These sorts of elements in the XML file do not need to have the android:id
attribute to give them a name.
Anything you do want to use in your Java source, though, needs an android:id
.
The convention is to use @+id/...
as the id value, where the ...
represents your locally-unique name for the widget in question. In the XML layout example in the preceding section, @+id/button
is the identifier for the Button
widget.
Android provides a few special android:id
values, of the form @android:id/...
. We will see some of these in various chapters of this book, such as Chapters 8 and 10.
- 4.4.4 The Dispatcher
- About the author
- Chapter 7. The state machine
- Appendix E. Other resources and links
- Example NAT machine in theory
- Using Double Quotes to Resolve Variables in Strings with Embedded Spaces
- The final stage of our NAT machine
- Compiling the user-land applications
- The conntrack entries
- Untracked connections and the raw table
- Drawbacks with restore
- Basics of the iptables command