Top Banner
Beyond the Hello World -Golf Scores Frank Xu Gannon University
24

Beyond the Hello World -Golf Scores

Feb 20, 2016

Download

Documents

kiril

Beyond the Hello World -Golf Scores. Frank Xu Gannon University. Reference. Learn how to develop for Android, Beyond HelloWorld http://www.youtube.com/watch?v=rm-hNlTD1H0. main.xml. Layout of Main.xml. TextView = label (Java). Property ( Name,Values pair) . - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Beyond the Hello World -Golf Scores

Beyond the Hello World-Golf Scores

Frank XuGannon University

Page 2: Beyond the Hello World -Golf Scores

Reference•Learn how to develop for Android,

Beyond HelloWorld•http://www.youtube.com/watch?v=rm-hNl

TD1H0

Page 3: Beyond the Hello World -Golf Scores
Page 4: Beyond the Hello World -Golf Scores
Page 5: Beyond the Hello World -Golf Scores

main.xml

Page 6: Beyond the Hello World -Golf Scores

Layout of Main.xml

Page 7: Beyond the Hello World -Golf Scores

TextView = label (Java)

Page 8: Beyond the Hello World -Golf Scores

Property (Name,Values pair)

Page 9: Beyond the Hello World -Golf Scores

How to change resource “hello” to “title”?•Change “hello” to “title” in string.xml•Change property value of Text from

“@string/hello” to “@string/title” in main.xml

Page 10: Beyond the Hello World -Golf Scores

Change size of TextView

Px: pixleDp: Density-independent Pixels. an abstract unit that is based on the physical density of the screen. Sp: Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference.

Page 11: Beyond the Hello World -Golf Scores
Page 12: Beyond the Hello World -Golf Scores

Add buttons

Drag&drop

Page 13: Beyond the Hello World -Golf Scores

Add button

Page 14: Beyond the Hello World -Golf Scores

How to Change ID and Text

Page 15: Beyond the Hello World -Golf Scores

Add More Components

Page 16: Beyond the Hello World -Golf Scores

Mapping UI to XML

Page 17: Beyond the Hello World -Golf Scores

Rearrange components

1. Add LinearLayoutScorePanel2. Move up and down3. Rearrange components use up

and down

Page 18: Beyond the Hello World -Golf Scores

Main.xml again

Page 19: Beyond the Hello World -Golf Scores

LayoutParams•Describes how big the view wants to be

for both width and height.•FILL_PARENT

▫Renamed MATCH_PARENT in API Level 8 and higher

▫The view wants to be as big as its parent (minus padding)

•WRAP_CONTENT▫The view wants to be just big enough to

enclose its content (plus padding)

Page 20: Beyond the Hello World -Golf Scores
Page 21: Beyond the Hello World -Golf Scores

Layout Width

Page 22: Beyond the Hello World -Golf Scores

Button Layout

Take as much as space as possible

Page 23: Beyond the Hello World -Golf Scores

New Look•Can you finish

yours like this?•Hints

▫Scores Gravity: center Padding: 10sp

▫- weight: 1▫+weight:1▫99 weight: none▫OK weight: 0.5

Page 24: Beyond the Hello World -Golf Scores

Test your UI