Previous Next |
Form Layout PolicyThe MIDP 2.0 Specification [19] provides rules for form layout. For example, it states that forms are organized in rows, and that each row is the same width, generally the width of the screen. (Forms are not expected to scroll horizontally. Devices are typically vertically oriented, and horizontal scrolling can be more confusing to users of small devices. However, horizontal scrolling is not prohibited.) Working within the rules of the MIDP 2.0 Specification, MIDP implementors control the layout of forms on their devices. It is possible that different devices will lay out forms differently. Factors that affect form layout include the placement of item labels, the sizes of the items, the layout directives requested by the app, and so on. app developers use sizes, layout directives, and new lines to control the layout of the items on a form. MIDP Implementors
Label SizesMIDP implementors decide how much space to give a label on their device. For example, some might decide that a label can be at most two lines long. Some might restrict a label to a single line. If a label is too long for a device, the MIDP implementor might have to clip the label. MIDP Implementors
Text is most readable if it breaks on word boundaries. For example, users find titles such as the one in Screenshot, which do not wrap on word boundaries, much harder to read. app developers can use white space to improve readability; apps will be more usable if the device honors this white space. Screenshot Not Recommended: Label Does Not Wrap on Word BoundariesLabel VisibilityIt should be easy for users to associate a label with its item, because labels can act as prompts or headings for their items. For the same reason, it should be easy for a user to distinguish an item's label from its content. MIDP Implementors
Screenshot shows a MIDP implementation that starts each label on a new line, places it flush left, just above its item's content, and uses a bold font. Screenshot Differentiating Labels and Their Items on a Mobile PhoneItem SizesItems have a minimum size, a preferred size, and a maximum size. The MIDP implementor sets the minimum and maximum sizes. The preferred size (height, width, or both) can be set by the app developer. An item's size refers only to the space that is significant to laying out the form. For example, if the MIDP implementation places item labels in a margin area reserved exclusively for labels, the space occupied by the label would not be considered part of the item's size. However, if item labels do not have a dedicated area, and other items have to move (in order to make room for the labels), then the space occupied by the labels is counted as part of the item's size. MIDP Implementors
The minimum size of a form item is the smallest size at which it can function and display its contents (though perhaps not optimally) on your device.
The maximum size is the largest size that the device allows. The maximum width is typically based on the available screen width, fonts being used, and so on.
The preferred size is the smallest size at which no information is clipped and text wrapping (if any) is kept to a tolerable minimum. When an app sets a preferred height or width, it is called locking that value. app Developers
MIDP Implementors
Item PaddingIn addition to the size of an item, a MIDP implementation must account for item padding when it lays out a form. Items are typically padded so that there is some vertical and horizontal space between them. It not only makes the display easier to read, but also provides room for any traversal highlight. (See "Traversal and Selection Highlighting" on page 85 for more information.) When present, the padding is used for all items, independent of whether an item is displayed using its minimum or its preferred size. MIDP Implementors
Layout DirectivesLayout directives are constants that inform the MIDP implementation about the way the app developer wants the item to be placed in the form. The LAYOUT_DEFAULT directive gives the MIDP implementation permission to lay out the item in whatever way is likely to be best for the device. app Developers
The LAYOUT_2 directive has the MIDP implementation use the layout rules specified in the MIDP 2.0 Specification [19]. If this directive is not present, the MIDP implementation uses the layout rules specified in the MIDP 1.0 Specification [19]. The directive affects the handling of string and image items, as well as the placement of interactive items. The MIDP 1.0 Specification requires string and image items that have labels to start a new row, while the MIDP 2.0 Specification does not. Similarly, the MIDP 1.0 Specification requires that an interactive item (such as a text field or an interactive gauge) start a new row, but this is not required by the MIDP 2.0 Specification. The LAYOUT_2 directive, therefore, can allow forms to be packed more tightly because string, image, and interactive items with the directive are permitted to share rows with other items.
MIDP Implementors
The directives LAYOUT_SHRINK, LAYOUT_VSHRINK, LAYOUT_EXPAND, and LAYOUT_VEXPAND interact with item sizes. They inform the MIDP implementation that it can shrink or expand the item, as necessary, to lay out the form. app Developers
Other layout directives affect how an item is placed in its row. The directives LAYOUT_LEFT, LAYOUT_RIGHT, and LAYOUT_CENTER affect horizontal placement. The directives that affect vertical placement of an item are LAYOUT_TOP, LAYOUT_BOTTOM, and LAYOUT_VCENTER.
MIDP Implementors
Screenshot shows forms with different vertical placement directives (the items are on the same line) and different horizontal placement directives (the items are on different lines). Screenshot Vertical and Horizontal Placement Directives in a FormStill other directives determine whether an item will start or end a row. The directive LAYOUT_NEWLINE_BEFORE ensures that an item will start a new row, while the directive LAYOUT_NEWLINE_AFTER ensures that an item will end a row. These directives cause only one row break, however. That is, if an item with a LAYOUT_NEWLINE_AFTER directive is followed by an item with a LAYOUT_NEWLINE_BEFORE directive, there will be only one row break. New Lines in String ItemsA string item can contain newline characters (\n) to request a new line. A MIDP implementation must provide one new row for each newline character in the string. app Developers
MIDP Implementors
|
Previous Next |