The Buttons example describes how to define a Button and a ToggleButton. In this example, the definition of/res/layout/buttons_1.xml is as follows:
<! -Regular sized buttons->
<Button android: id = "@ + id/button_normal"
Android: text = "@ string/buttons_0000normal"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"/>
<! -Small buttons->
<Button android: id = "@ + id/button_small"
Style = "? Android: attr/buttonStyleSmall"
Android: text = "@ string/buttons_javassmall"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"/>
<ToggleButton android: id = "@ + id/button_toggle"
Android: text = "@ string/buttons_javastoggle"
Android: textOn = "Open"
Android: textOff = "Close"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"/>
When a button is defined and no style is specified, Android displays the Button in normal size,
Style? Android: attr/buttonStyleSmall: display the Button in a compact style.
When referencing the Style property value, use "?" Instead of "@" to specify the required style attributes. The format is as follows:
? [<Package_name >:] [<resource_type>/] <resource_name>
The resource_type part is optional. Therefore, the following definitions can be used in this example:
Style = "? Android: buttonStyleSmall"
ToggleButton uses the button form to define two states, such as Open and Close. The default text is ON and OFF. You can use the attributes textOn and textOff to redefine the text.