Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Denver Droids: UI
Search
Dave Smith
April 20, 2011
Programming
2
100
Denver Droids: UI
My first ever Android presentation. Uploaded for posterity.
Dave Smith
April 20, 2011
Tweet
Share
More Decks by Dave Smith
See All by Dave Smith
Android Security Features
devunwired
4
680
ConstraintLayout, Inside and Out
devunwired
21
1.7k
Digging Into Android System Services
devunwired
8
1.5k
Flattening Layouts with Constraints
devunwired
3
280
Hello, Brillo: ELC Edition
devunwired
0
250
Mastering CoordinatorLayout Behaviors
devunwired
16
1.4k
Hello, Brillo
devunwired
1
2k
Google Proximity Beacons Overview
devunwired
4
230
Proximity Beacons and the Nearby API
devunwired
1
1.9k
Other Decks in Programming
See All in Programming
GraphRAGの仕組みまるわかり
tosuri13
8
520
XP, Testing and ninja testing
m_seki
3
220
地方に住むエンジニアの残酷な現実とキャリア論
ichimichi
5
1.5k
ニーリーにおけるプロダクトエンジニア
nealle
0
710
スタートアップの急成長を支えるプラットフォームエンジニアリングと組織戦略
sutochin26
0
310
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
2
330
PHPでWebSocketサーバーを実装しよう2025
kubotak
0
250
#QiitaBash MCPのセキュリティ
ryosukedtomita
0
760
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
220
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
1
720
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
610
GoのGenericsによるslice操作との付き合い方
syumai
3
710
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
134
9.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Rails Girls Zürich Keynote
gr2m
94
14k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
The Cult of Friendly URLs
andyhume
79
6.5k
Bash Introduction
62gerente
614
210k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
GraphQLとの向き合い方2022年版
quramy
49
14k
Scaling GitHub
holman
459
140k
Rebuilding a faster, lazier Slack
samanthasiow
82
9.1k
Music & Morning Musume
bryan
46
6.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Transcript
Crea%ng(UI(the(Smart/Kid(Way( Dave(Smith( April(20,(2011( @devunwired(
Who(is(this(guy?( • Mobile(Developer((Android(&(iOS)( • Recovering(Spark(Chaser( – Embedded(Systems( – Hardware(Integrator( • Co/Author(of(Android(Recipes( – Shameless(Plug(&(Giveaway(
10,000(Foot(View( • UI(Libraries( • Using(Resources(to(make(DIY(Easier( – Screen(Support( – Rota%on( • Sample(Applica%on(
Google’s(UI(Design(PaWerns( • Dashboard( • Ac%on(Bar( • Quick(Ac%on( Images(Courtesy(of(androiduipaWerns.com(
Use(a(Library.((Move(on.( • DashboardLayout( – Roman(Nurik(@(Google( – Custom(Layout(for(Dashboard(Grids( – gist.github.com/882650( •
GreenDroid( – Requires(a(custom(Applica%on(class((Boo)( – Ac%onBar( – QuickAc%on( – AsyncImageView( – github.com/cyrilmoaer/GreenDroid( • Ac%onBarSherlock( – Drop/in(Widget( – Honeycomb(Compa%ble(Ac%onBar( – github.com/JakeWharton/Ac%onBarSherlock( • CommonsWare(Android(Components((CWAC)( – EndlessAdapter( – ColorMixer( – github.com/commonsguy(
GreenDroid(Sample(Demo( • Ac%onBar( – Ac%onBarItem( – LoaderAc%onBarItem( • QuickAc%on( • AsyncImageView(
How(Android(Classifies(Screens( • Size( – Small((<3")( – Normal((3"/5")( – Large((5"/7")( –
xLarge((7"/10";(Android(2.3)( • Density( – Low((ldpi)( • 75%(MDPI( – Medium((mdpi)( – High((hdpi)( • 150%(MDPI( – Xtra/High((xhdpi;(Android(2.2)( • 200%(MDPI( • Eek!((That's(16(Different(Configura%ons(to(support!(…Not(really(
Recipe(for(Phone(UI( • Scale(Images(for(all(Densi%es( • Build(Layouts(for(one(size( res/drawable( res/drawable/ldpi( res/drawable/mdpi( res/drawable/hdpi( res/layout(
res/layout/land( • Shut(out(tablets(by(adding(the(following(manifest(item:( <uses-feature !android:name="android.hardware.telephony"/>!
Recipe(for(Adding(Tablet(Support( • Double(your(MDPI(Assets(Resolu%ons( • Add(layouts(for(larger(screens( res/layout/large( res/layout/large/land( res/layout/xlarge( res/layout/xlarge/land( •
"3.0(only"(support(can(use(the(v11(qualifier(instead( res/layout/v11( res/layout/v11/land( • Shut(out(phones(by(adding(the(following(manifest(item:( <supports-screens! !!android:smallScreens="false"! !!android:normalScreens="false"/>!
Smart(Kids(Use(XML( • Use(XML(whenever(possible!( – Android(itself(has(more(lines(of(XML(than(any(other( language((Java,(C,(or(C++)…learn(from(that.( – XML(Resources(are(inherently(scalable( • Shapes(
• Gradients( • Selectors((Color,(Image)( • Place(all(XML(drawables(into(res/drawable( – Resolu%on(Independent( • 9/Patches(are(annoying,(try(to(avoid(them(
Suppor%ng(Rota%on( • Why(should(I?((It's(Hard!( – Tablets(are(na%ve(landscape( – Physical(keyboard(devices( • Plus…it's(not(that(hard.( • Ease(the(pain(by(handling( yourself(where(possible,(and(
locking(where(appropriate.(
The(Problem( • Tradi%onal(Rota%on(destroys(the(Ac%vity(and( then(recreates(it.( – This(requires(saving(of(UI(state( – It's(slow( – WTH(do(we(do(with(running(background( opera%ons?(
Easy(Road:(Lock(It!( • Some%mes,(locking(an(Ac%vity(is(appropriate( – Video(Player(or(Camera(Overlay(always(displaying( in(Landscape( • To(lock,(simply(add( android:screenOrientation="portrait"(or( android:screenOrientation="landscape"(to( the(<activity>(element(
– Locking(is(per(Ac%vity,(not(global(to(the( applica%on(
Smart/Kid(Road:(Handle(It(Yourself( • Tell(Android(to(no%fy(you(of(the(change,(and(you'll(take(care(of(the( upkeep( • Add(android:configChanges="keyboardHidden|orientation"(to( the(<activity>(element( • Implement(onConfigurationChanged()(in(the(Ac%vity(code.( •
Android(will(not(destroy(your(Ac%vity( • If(you(do(not(have(separate(resources((layouts,(etc.)(for(landscape( vs.(portrait…you're(done!( • If(you(DO(have(a(special("layout/land"(or(the(like,(a(quick(call(to( setContentView()(will(redraw(your(view(with(the(right(resources.( – You(will(also(have(to(reaWach(any(pointers(grabbed(through( findViewById()! • No(other(state(need(be(saved(or(restored.!
Fixing(a(Tradi%onal(Headache( • With(tradi%onal(rota%on,(persis%ng(objects(is( s%ll(a(mess.( • A(background(opera%ons((like(AsyncTask)(can't( be(stuffed(in(a(Bundle.( • onRetainNonConfigurationInstance()( – Pass(any(single(object(across(a(rota%on(life/cycle.(
• getLastNonConfigurationInstance()! – Retrieve(the(object(upon(re/crea%on.(
Let's(Play(With(Some(Code!(