chapter 6 - views part 1

Post on 11-Apr-2017

91 Views

Category:

Education

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Views: Part 1

View

View This class represents the basic building

block for user interface components

“A Big Mom”

Lab: Change Background

TextView

TextView Displays text to the user and op;onally

allows them to edit it. A TextView is a complete text editor, however the basic

class is configured to not allow edi;ng

Lab: Change text’s color & text’s style Lab: Html.fromHtml

More Examples

Rule 9: Always set textSize for TextView

EditText

EditText EditText is a thin veneer over TextView

that configures itself to be editable.

Lab: Input Type

Bu8on

BuHon Represents a push-buHon widget. Push-

buHons can be pressed, or clicked, by the user to perform an ac;on.

Lab: Handle Click

TextView & EditText & Bu8on

Mash up !

CheckBox

CheckBox A checkbox is a specific type of two-

states buHon that can be either checked or unchecked

RadioBu8on & RadioGroup

RadioBuHon A radio buHon is a two-states buHon

that can be either checked or unchecked. When the radio buHon is

unchecked, the user can press or click it to check it. However, contrary to a

CheckBox, a radio buHon cannot be unchecked by the user once checked.

Radio buHons are normally used together in a RadioGroup.

Lab: Simple Calculator

Mash up some more !

ProgressBar

ProgressBar

Visual indicator of progress in some opera;on. Displays a bar to the user

represen;ng how far the opera;on has progressed; the applica;on can change the amount of progress (modifying the length of the bar) as it moves forward.

Switch

Switch

A Switch is a two-state toggle switch widget that can select between two

op;ons. The user may drag the "thumb" back and forth to choose the selected op;on, or simply tap to toggle as if it

were a checkbox.

ToggleBu8on

ToggleBuHon

Displays checked/unchecked states as a buHon with a "light" indicator and by

default accompanied with the text "ON" or "OFF".

Rarely used

top related