mobile programming - sharifce.sharif.edu/courses/94-95/2/ce327-1/resources/root/lecture notes... ·...

29
Mobile Programming Sharif University of Technology Spring 2016 Lecture 3 Omid Jafarinezhad

Upload: trannguyet

Post on 10-Mar-2019

245 views

Category:

Documents


2 download

TRANSCRIPT

MobileProgramming

Sharif University of Technology

Spring 2016

Lecture 3

Omid Jafarinezhad

Code structure - resources

• User interface layout specified in XML file

Code structure – src/java

Code structure – src/java

A example

A example

Compound Drawable

Compound Drawable

rotating_loading

• <!-- res/drawable/rotating_loading.xml -->

• AnimatedRotateDrawable implements Animatable

animated_wifi

• <!-- res/drawable/animated_wifi.xml -->

• AnimationDrawable implements Animatable

AnimatedCompoundDrawableActivity

animated_clock

animated_clock

• <!-- res/drawable/animated_clock.xml -->

• AnimatedVectorDrawable implements Animatable

• Introduced in Lollipop

Shadow

• shadowColor, shadowDx, shadowDy, shadowRadius

• px, not dp

Shadow

Shadow

Custom font

Gradient

Pattern

Multiple styles

Multiple styles

Multiple styles

Spans, a Powerful Concept

• Font metrics

Spans, a Powerful Concept

• Supported tags

– Defined by platform

– Can be extended with custom TagHandler

Spans, a Powerful Concept

• if a Span affects character-level text formatting, it extends CharacterStyle– e.g. ForegroundColorSpan, BackgroundColorSpan, UnderlineSpan

• if a Span affects paragraph-level text formatting, it implements ParagraphStyle• e.g. BulletSpan, IconMarginSpan, QuoteSpan

• if a Span modifies the character-level text appearance, it implements UpdateAppearance– e.g. ImageSpan, LocaleSpan, MaskFilterSpan, MetricAffectingSpan,

RasterizerSpan,, ReplacementSpan, ScaleXSpan, StrikethroughSpan, StyleSpan

• if a Span modifies the character-level text metrics|size, it implements UpdateLayout

• For more info: http://flavienlaurent.com/blog/2014/01/31/spans/

Styled string

Styled string

AlignmentSpan

Rainbow span