chapter 6 - views part 1

14
Views: Part 1

Upload: sittiphol-phanvilai

Post on 11-Apr-2017

89 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Chapter 6 - Views Part 1

Views: Part 1

Page 2: Chapter 6 - Views Part 1

View

View This class represents the basic building

block for user interface components

“A Big Mom”

Lab: Change Background

Page 3: Chapter 6 - Views Part 1

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

Page 4: Chapter 6 - Views Part 1

More Examples

Page 5: Chapter 6 - Views Part 1

Rule 9: Always set textSize for TextView

Page 6: Chapter 6 - Views Part 1

EditText

EditText EditText is a thin veneer over TextView

that configures itself to be editable.

Lab: Input Type

Page 7: Chapter 6 - Views Part 1

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

Page 8: Chapter 6 - Views Part 1

TextView & EditText & Bu8on

Mash up !

Page 9: Chapter 6 - Views Part 1

CheckBox

CheckBox A checkbox is a specific type of two-

states buHon that can be either checked or unchecked

Page 10: Chapter 6 - Views Part 1

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.

Page 11: Chapter 6 - Views Part 1

Lab: Simple Calculator

Mash up some more !

Page 12: Chapter 6 - Views Part 1

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.

Page 13: Chapter 6 - Views Part 1

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.

Page 14: Chapter 6 - Views Part 1

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