Many of the typical attributes of TextView controls, such as textColor and textSize, are available for the Button text label. You need two simple Button controls for the settings screen: one for launching the Password Dialog window and one for launching the DatePickerDialog. You configure these Button controls by giving each a unique identifier and setting the text attribute labels of each. You also set each Button control's layout_width and layout_height attributes to wrap_con-tent so that each button scales appropriately, based on the text label.
Did you Know?
The Android platform actually supports two kinds of Button controls: the basic Button control and the ImageButton control. An ImageButton control behaves much like a regular Button control, only instead of displaying a text label, it displays a Drawable image resource.
You can use attributes to modify the look of a Button control. For example, you can change the shape of the button (by default, a white rectangle with rounded corners) by setting the background, drawableTop, drawableBottom, drawableLeft, and drawableRight attributes of the Button to a Drawable resources.
Try changing the look of the Button control called Button_DOB by taking the following steps in the settings.xml layout file:
1. Change the background property of the Button control to the Drawable graphic resource called @drawable/textured.
2. Change the drawableTop property of the Button control to the Drawable graphic resource called @drawable/divider.
3. Change the drawableBottom property of the Button control to the Drawable graphic resource called @drawable/divider. Note that the Button control is now an ugly orange menace on the screen. You've created a monster.
4. Change the Button control back to the default Button control look and feel by removing the background, drawableTop, and drawableBottom properties from Button_DOB. ▲
Was this article helpful?