| Roman Nurik | b99ae73 | 2012-03-06 12:26:15 -0800 | [diff] [blame] | 1 | page.title=Text Fields |
| 2 | @jd:body |
| 3 | |
| 4 | <p>Text fields allow the user to type text into your app. They can be either single line or multi-line. |
| 5 | Touching a text field places the cursor and automatically displays the keyboard. In addition to |
| 6 | typing, text fields allow for a variety of other activities, such as text selection (cut, copy, |
| 7 | paste) and data lookup via auto-completion.</p> |
| 8 | |
| 9 | |
| 10 | <div class="layout-content-row"> |
| 11 | <div class="layout-content-col span-12"> |
| 12 | |
| 13 | <img src="{@docRoot}design/media/text_input_singlevsmultiline.png"> |
| 14 | |
| 15 | </div> |
| 16 | </div> |
| 17 | |
| 18 | <h4>Single line and multi line</h4> |
| 19 | <p>Single-line fields automatically scroll their content to the left as the text input cursor reaches |
| 20 | the right edge of the input field. Multi-line text fields automatically break to a new line for |
| 21 | overflow text and scroll vertically when the cursor reaches the lower edge.</p> |
| 22 | |
| 23 | <img src="{@docRoot}design/media/text_input_typesandtypedown.png"> |
| 24 | |
| 25 | <div class="layout-content-row"> |
| 26 | <div class="layout-content-col span-6"> |
| 27 | |
| 28 | <h4>Text field types</h4> |
| 29 | <p>Text fields can have different types, such as number, message, or email address. The type determines |
| 30 | what kind of characters are allowed inside the field, and may prompt the virtual keyboard to |
| 31 | optimize its layout for frequently used characters.</p> |
| 32 | |
| 33 | </div> |
| 34 | <div class="layout-content-col span-6"> |
| 35 | |
| 36 | <h4>Auto-complete text fields</h4> |
| 37 | <p>Use auto-complete text fields to present real-time completions or search results in popups, so users |
| 38 | can enter information more accurately and efficiently.</p> |
| 39 | |
| 40 | </div> |
| 41 | </div> |
| 42 | |
| 43 | <h2 id="text-selection">Text Selection</h2> |
| 44 | |
| 45 | <p>Users can select any word in a text field with a long press. This action triggers a text selection |
| 46 | mode that facilitates extending the selection or choosing an action to perform on the selected text. |
| 47 | Selection mode includes:</p> |
| 48 | |
| 49 | <div class="layout-content-row"> |
| 50 | <div class="layout-content-col span-9"> |
| 51 | |
| 52 | <img src="{@docRoot}design/media/text_input_textselection.png"> |
| 53 | |
| 54 | </div> |
| 55 | <div class="layout-content-col span-4 with-callouts"> |
| 56 | |
| 57 | <ol> |
| 58 | <li> |
| 59 | <h4>Contextual action bar</h4> |
| 60 | <p>A contextual action bar (CAB) displays the actions available to perform on the selection: |
| 61 | typically cut, copy, and paste, but apps can insert additional commands as needed.</p> |
| 62 | </li> |
| 63 | <li> |
| 64 | <h4>Selection handles</h4> |
| 65 | <p>Selection handles can be dragged to select more or less text while remaining in selection mode.</p> |
| 66 | </li> |
| 67 | </ol> |
| 68 | |
| 69 | </div> |
| 70 | </div> |