close

Вход

Забыли?

вход по аккаунту

код для вставкиСкачать
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=rmhNlTD1H0
main.xml
Layout of Main.xml
TextView = label (Java)
Property (Name,Values pair)
How to change resource “hello” to
“title”?
• Change “hello” to “title” in string.xml
• Change property value of Text from
[email protected]/hello” to [email protected]/title” in main.xml
Change size of TextView
Px: pixle
Dp: 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.
Add buttons
Drag&drop
Add button
How to Change ID and Text
Add More Components
Mapping UI to XML
Rearrange components
1. Add LinearLayoutScorePanel
2. Move up and down
3. Rearrange components use up and
down
Main.xml again
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)
Layout Width
Button Layout
Take as much as space as possible
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
Test your UI
1/--страниц
Пожаловаться на содержимое документа