Fields of Green. Or Other Colors.
Along with buttons and labels, fields are the third “anchor” of most GUI toolkits. In Android, they are implemented via the widget, which is a subclass of the used for labels.
Along with the standard properties (e.g., ), has many others that will be useful for you in constructing fields, including:
• , to control if the field should provide automatic spelling assistance
• , to control if the field should automatically capitalize the first letter of entered text (e.g., first name, city)
• , to configure the field to accept only certain digits
• , to control if the field is for single‑line input or multiple‑line input (e.g., does Enter move you to the next widget or add a newline?)
Beyond those, you can configure fields to use specialized input methods, such as for numeric‑only input, for shrouded password input, and for entering in phone numbers. If you want to create your own input method scheme (e.g., postal codes, Social Security numbers), you need to create your own implementation of the interface, then configure the field to use it via .
For example, from the project, here is an XML layout file showing an :
Note that is false, so users will be able to enter in several lines of text.
For this project, the file populates the input field with some prose:
Package
Import
Import
Import
Дата добавления: 2015-05-16; просмотров: 1112;