SlideShare ist ein Scribd-Unternehmen logo
1 von 53
Working with Multiple Screens Make Your Android UI Rock Everywhere
Suzanne Alexandra Android Developer Advocate, Motorola @suzalex http://moto.ly/samples © 2010 Motorola Mobility, Inc. All rights reserved except as otherwise explicitly indicated.
Why does it matter?
Make users happy Extend your reach
Size really mattersPause  &  Watch DialingWandhttp://moto.ly/dialingwand
Key Point #1Choose your target devices
Android 1.5? QVGA? Global? As of November 2010, developer.android.com
FLIPOUT DROID PRO DROID X
Comparing resolution DROID X480 x 854 Normal DROID PRO320 x 480 Normal FLIPOUT320 x 240 Small
Comparing resolution DROID XHigh240 dpi DROID PROMedium160 dpi FLIPOUTLow120 dpi
Key Point #2Start with a fewsimple guidelines.
Pause the slides  & watch the PhotoDemo video on YouTube
Adjust your AndroidManifestfor versions and screen sizes.
<uses-sdk android:minSdkVersion= "7"  		       android:targetSdkVersion= "8" />
<supports-screens 		     android:largeScreens= "true"              android:normalScreens="true"              android:smallScreens="true"              android:anyDensity="true" />
But be careful ,[object Object]
  Test thoroughly on your targetSdkVersion
  Make sure you don't get size compatibility mode,[object Object]
BonusScreen orientation and performance
Use adaptable measurements,like dip and sp.
Low 1 dip = 0.75 pixels High 1 dip = 1.5 pixels Medium 1 dip = 1 pixel What’s a DIP? A pixel that changes size
Pause the slides &  Watch the RelativeLayout video on YouTube
Use one set of images andlet Android scale them, for now. But we’ll look at this more later.
Key Point #3 Add custom resources as needed, but watch performance.
Add custom layouts, if you need them.But you might not.
Choose an image strategy ,[object Object]
  Custom resource sets for low, medium, and high density?
  Target the most commonly used density?
  Retrieve images dynamically at runtime and handle?,[object Object]
150% for high 100% for normal 75% for low
Memory vs file size PhotoOne	 32 MBmemory                            	 324 KB size  PhotoThree	 23 MBmemory 728 KB size
In other words Autoscaling uses memory.Custom image sets increase file size.
What happens if you load a really big image 				into a small view?
You might get  No image Or a memory error
Your application UI can behave differently across devicesor in different conditionsdue to memory
Pause the slides &  Watch the handling images video on YouTube
private Bitmap loadBitmap() {      	DisplayMetrics metrics = new DisplayMetrics();     	getWindowManager().getDefaultDisplay().getMetrics(metrics); int screenDensity = metrics.densityDpi;     	BitmapFactory.Options options = new BitmapFactory.Options();     	options.inJustDecodeBounds = false; options.inSampleSize = 4;     	options.inScaled = true; options.inTargetDensity = screenDensity;     	Bitmap bitmap = BitmapFactory.decodeResource(getResources(),  			            R.drawable.clover, options);     	return bitmap;  }
If you need to detect density at runtimeandroid.util.DisplayMetricsis cool
Pause the slides &Watch the detecting device density video on YouTube
240 and 1.5 120 and 0.75 160 and 1.0
public void checkDensity()  {       DisplayMetrics metrics = new DisplayMetrics();       getWindowManager().getDefaultDisplay().getMetrics(metrics); 	   String logical_density = Float.toString(metrics.density);       Log.e (TAG, "Logical density is " + logical_density); 	    // for API level 4 (Android 1.6) and forward       String screen_density = Integer.toString(metrics.densityDpi);       Log.e (TAG, "Screen density is " + screen_density); }
Key Point #4 Touch and gesture are key. Make sure they’re density independent too.
Pause the slides &Watch the buttons video on YouTube
<ImageButton 	android:id="@+id/button"  	android:src="@drawable/button"  	android:clickable="true"  	android:layout_gravity="center_vertical|center_horizontal"  android:layout_width="wrap_content"      	android:layout_height="wrap_content" 	android:background="@null" android:padding="40dip" />
16 pixels 3.3 mm 1.7 mm 2.5 mm
private static final float DISTANCE_DIP = 16.0f; private static final float PATH_DIP = 40.0f;  // convert dip measurements to pixels  final float scale = getResources().getDisplayMetrics().density;  scaledDistance = (int) ( DISTANCE_DIP * scale + 0.5f );  scaledPath = (int) ( PATH_DIP * scale + 0.5f );
Okay .. Remember the key points?
Once again … ,[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53
Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53
Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53mvourtsian
 
αμυντικοί μηχανισμοί του ανθρώπινου σώματος
αμυντικοί μηχανισμοί του ανθρώπινου σώματος  αμυντικοί μηχανισμοί του ανθρώπινου σώματος
αμυντικοί μηχανισμοί του ανθρώπινου σώματος Άρτεμη Μπάρκα
 
ΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣ
ΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣ
ΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣstefmar8
 
ενότητα 11 (παιχνιδια)
ενότητα 11 (παιχνιδια)ενότητα 11 (παιχνιδια)
ενότητα 11 (παιχνιδια)Giorgos Baroutas
 
Μπέρτολτ Μπρεχτ
Μπέρτολτ  ΜπρεχτΜπέρτολτ  Μπρεχτ
Μπέρτολτ ΜπρεχτEvangelia Patera
 
Ανθρώπινα δικαιώματα
Ανθρώπινα δικαιώματαΑνθρώπινα δικαιώματα
Ανθρώπινα δικαιώματαchavalesnick
 
Θανατική ποινή
Θανατική ποινήΘανατική ποινή
Θανατική ποινήchavalesnick
 
Συνάρτηση "1-1"
Συνάρτηση "1-1"Συνάρτηση "1-1"
Συνάρτηση "1-1"peri2005
 
ΑΝΘΡΩΠΙΝΑ ΔΙΚΑΙΩΜΑΤΑ
ΑΝΘΡΩΠΙΝΑ  ΔΙΚΑΙΩΜΑΤΑΑΝΘΡΩΠΙΝΑ  ΔΙΚΑΙΩΜΑΤΑ
ΑΝΘΡΩΠΙΝΑ ΔΙΚΑΙΩΜΑΤΑPELAMAKI
 
Το ιδανικό σχολείο
Το ιδανικό σχολείοΤο ιδανικό σχολείο
Το ιδανικό σχολείοgeormak
 
παράγραφος τρόποι ανάπτυξης
παράγραφος τρόποι ανάπτυξηςπαράγραφος τρόποι ανάπτυξης
παράγραφος τρόποι ανάπτυξηςorfeas70
 
ΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣ
ΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣ
ΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣAlexandra Gerakini
 
Η πειθώ στη διαφημιση
Η πειθώ στη διαφημιση   Η πειθώ στη διαφημιση
Η πειθώ στη διαφημιση Ελενη Λιουσα
 
6. ραψωδία ζ 139-259, ραψωδία ι 240-512
6. ραψωδία ζ 139-259, ραψωδία ι 240-5126. ραψωδία ζ 139-259, ραψωδία ι 240-512
6. ραψωδία ζ 139-259, ραψωδία ι 240-512JoannaArtinou
 
κλιση του λυω
κλιση του λυωκλιση του λυω
κλιση του λυωssuser5a7e1c
 
Διαφήμιση
ΔιαφήμισηΔιαφήμιση
Διαφήμισηsokaniak
 
αρχαια ελληνικη ενδυμασια
αρχαια ελληνικη ενδυμασιααρχαια ελληνικη ενδυμασια
αρχαια ελληνικη ενδυμασιαvenetokleiakia
 
Λατινικά, ενότητα 31
Λατινικά, ενότητα 31Λατινικά, ενότητα 31
Λατινικά, ενότητα 31gina zaza
 

Was ist angesagt? (20)

Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53
Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53
Φύλλο εργασίας δομημένης μορφής στην Ιλιάδα ,ραψ.Α 1-53
 
αμυντικοί μηχανισμοί του ανθρώπινου σώματος
αμυντικοί μηχανισμοί του ανθρώπινου σώματος  αμυντικοί μηχανισμοί του ανθρώπινου σώματος
αμυντικοί μηχανισμοί του ανθρώπινου σώματος
 
ΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣ
ΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣ
ΔΕΥΤΕΡΕΥΟΥΣΕΣ ΠΡΟΤΑΣΕΙΣ
 
ενότητα 11 (παιχνιδια)
ενότητα 11 (παιχνιδια)ενότητα 11 (παιχνιδια)
ενότητα 11 (παιχνιδια)
 
γαλλική επανάσταση
γαλλική επανάστασηγαλλική επανάσταση
γαλλική επανάσταση
 
Μπέρτολτ Μπρεχτ
Μπέρτολτ  ΜπρεχτΜπέρτολτ  Μπρεχτ
Μπέρτολτ Μπρεχτ
 
Ανθρώπινα δικαιώματα
Ανθρώπινα δικαιώματαΑνθρώπινα δικαιώματα
Ανθρώπινα δικαιώματα
 
Θανατική ποινή
Θανατική ποινήΘανατική ποινή
Θανατική ποινή
 
Συνάρτηση "1-1"
Συνάρτηση "1-1"Συνάρτηση "1-1"
Συνάρτηση "1-1"
 
ΑΝΘΡΩΠΙΝΑ ΔΙΚΑΙΩΜΑΤΑ
ΑΝΘΡΩΠΙΝΑ  ΔΙΚΑΙΩΜΑΤΑΑΝΘΡΩΠΙΝΑ  ΔΙΚΑΙΩΜΑΤΑ
ΑΝΘΡΩΠΙΝΑ ΔΙΚΑΙΩΜΑΤΑ
 
Το ιδανικό σχολείο
Το ιδανικό σχολείοΤο ιδανικό σχολείο
Το ιδανικό σχολείο
 
παράγραφος τρόποι ανάπτυξης
παράγραφος τρόποι ανάπτυξηςπαράγραφος τρόποι ανάπτυξης
παράγραφος τρόποι ανάπτυξης
 
ΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣ
ΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣ
ΟΣΟ ΜΠΟΡΕΙΣ, Κ.ΚΑΒΑΦΗΣ, ΦΥΛΛΟ ΕΡΓΑΣΙΑΣ
 
Η πειθώ στη διαφημιση
Η πειθώ στη διαφημιση   Η πειθώ στη διαφημιση
Η πειθώ στη διαφημιση
 
6. ραψωδία ζ 139-259, ραψωδία ι 240-512
6. ραψωδία ζ 139-259, ραψωδία ι 240-5126. ραψωδία ζ 139-259, ραψωδία ι 240-512
6. ραψωδία ζ 139-259, ραψωδία ι 240-512
 
κλιση του λυω
κλιση του λυωκλιση του λυω
κλιση του λυω
 
Διαφήμιση
ΔιαφήμισηΔιαφήμιση
Διαφήμιση
 
αρχαια ελληνικη ενδυμασια
αρχαια ελληνικη ενδυμασιααρχαια ελληνικη ενδυμασια
αρχαια ελληνικη ενδυμασια
 
Λατινικά, ενότητα 31
Λατινικά, ενότητα 31Λατινικά, ενότητα 31
Λατινικά, ενότητα 31
 
Νινέτ της Ζωρζ Σαρρή
Νινέτ  της Ζωρζ ΣαρρήΝινέτ  της Ζωρζ Σαρρή
Νινέτ της Ζωρζ Σαρρή
 

Ähnlich wie Working with Multiple Android Screens

Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011sullis
 
Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5Chris Griffith
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011sullis
 
Getting the Magic on Android Tablets
Getting the Magic on Android TabletsGetting the Magic on Android Tablets
Getting the Magic on Android TabletsOSCON Byrum
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15sullis
 
Using the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidUsing the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidXavier Hallade
 
HTC Developer - 2012
HTC Developer - 2012HTC Developer - 2012
HTC Developer - 2012Bruce Jones
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android ApplicationsCláudio André
 
Beginning Android Flash Development
Beginning Android Flash DevelopmentBeginning Android Flash Development
Beginning Android Flash DevelopmentStephen Chin
 
Creating Compelling Mobile User Experiences
Creating Compelling Mobile User ExperiencesCreating Compelling Mobile User Experiences
Creating Compelling Mobile User ExperiencesChris Griffith
 
Manual samsung galaxy tab 7.7
Manual samsung galaxy tab 7.7Manual samsung galaxy tab 7.7
Manual samsung galaxy tab 7.7Khaleeda Asa
 
Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...
Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...
Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...goodfriday
 

Ähnlich wie Working with Multiple Android Screens (20)

Ui patterns
Ui patternsUi patterns
Ui patterns
 
Beautifully Usable, Multiple Screens Too
Beautifully Usable, Multiple Screens TooBeautifully Usable, Multiple Screens Too
Beautifully Usable, Multiple Screens Too
 
Your First Adobe Flash Application for Android
Your First Adobe Flash Application for AndroidYour First Adobe Flash Application for Android
Your First Adobe Flash Application for Android
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
 
Getting the Magic on Android Tablets
Getting the Magic on Android TabletsGetting the Magic on Android Tablets
Getting the Magic on Android Tablets
 
Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5Developing AIR for Mobile with Flash Professional CS5.5
Developing AIR for Mobile with Flash Professional CS5.5
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
Getting the Magic on Android Tablets
Getting the Magic on Android TabletsGetting the Magic on Android Tablets
Getting the Magic on Android Tablets
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15
 
Using the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidUsing the Presentation API and external screens on Android
Using the Presentation API and external screens on Android
 
HTC Developer - 2012
HTC Developer - 2012HTC Developer - 2012
HTC Developer - 2012
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
 
Beginning Android Flash Development
Beginning Android Flash DevelopmentBeginning Android Flash Development
Beginning Android Flash Development
 
Creating Compelling Mobile User Experiences
Creating Compelling Mobile User ExperiencesCreating Compelling Mobile User Experiences
Creating Compelling Mobile User Experiences
 
Galaxy
Galaxy Galaxy
Galaxy
 
New widget
New widgetNew widget
New widget
 
campaing check outbound
campaing check outboundcampaing check outbound
campaing check outbound
 
Manual samsung galaxy tab 7.7
Manual samsung galaxy tab 7.7Manual samsung galaxy tab 7.7
Manual samsung galaxy tab 7.7
 
Android Presentation By Ashok Kumar Pachauri
Android Presentation By Ashok Kumar PachauriAndroid Presentation By Ashok Kumar Pachauri
Android Presentation By Ashok Kumar Pachauri
 
Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...
Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...
Lessons Learned: Designer/Developer Productivity in Windows Presentation Foun...
 

Mehr von Motorola Mobility - MOTODEV

HTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the FutureHTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the FutureMotorola Mobility - MOTODEV
 
Getting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & BeyondGetting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & BeyondMotorola Mobility - MOTODEV
 
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript Motorola Mobility - MOTODEV
 
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tabletsConsejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tabletsMotorola Mobility - MOTODEV
 
Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas Motorola Mobility - MOTODEV
 
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuarioCómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuarioMotorola Mobility - MOTODEV
 
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e RenderscriptGráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e RenderscriptMotorola Mobility - MOTODEV
 
Como integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testesComo integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testesMotorola Mobility - MOTODEV
 
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...Motorola Mobility - MOTODEV
 

Mehr von Motorola Mobility - MOTODEV (20)

HTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the FutureHTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the Future
 
The Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. WebThe Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. Web
 
Kill the Laptop!
Kill the Laptop!Kill the Laptop!
Kill the Laptop!
 
MOTODEV App Validator
MOTODEV App ValidatorMOTODEV App Validator
MOTODEV App Validator
 
Getting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & BeyondGetting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & Beyond
 
Introducing Fragments
Introducing FragmentsIntroducing Fragments
Introducing Fragments
 
Taking Advantage of Webtop
Taking Advantage of WebtopTaking Advantage of Webtop
Taking Advantage of Webtop
 
Building Quality Into Your Apps Through Testing
Building Quality Into Your Apps Through TestingBuilding Quality Into Your Apps Through Testing
Building Quality Into Your Apps Through Testing
 
Top Tips for Android UIs
Top Tips for Android UIsTop Tips for Android UIs
Top Tips for Android UIs
 
Designing Apps for Motorla Xoom Tablet
Designing Apps for Motorla Xoom TabletDesigning Apps for Motorla Xoom Tablet
Designing Apps for Motorla Xoom Tablet
 
Diseñando aplicaciones para el Motorola XOOM
Diseñando aplicaciones para el Motorola XOOM Diseñando aplicaciones para el Motorola XOOM
Diseñando aplicaciones para el Motorola XOOM
 
Presentación de los fragmentos
Presentación de los fragmentos Presentación de los fragmentos
Presentación de los fragmentos
 
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
 
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tabletsConsejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
 
Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas
 
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuarioCómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
 
Principais dicas para UIs do Android
Principais dicas para UIs do AndroidPrincipais dicas para UIs do Android
Principais dicas para UIs do Android
 
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e RenderscriptGráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
 
Como integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testesComo integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testes
 
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...
 

Kürzlich hochgeladen

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Working with Multiple Android Screens

  • 1. Working with Multiple Screens Make Your Android UI Rock Everywhere
  • 2. Suzanne Alexandra Android Developer Advocate, Motorola @suzalex http://moto.ly/samples © 2010 Motorola Mobility, Inc. All rights reserved except as otherwise explicitly indicated.
  • 3. Why does it matter?
  • 4. Make users happy Extend your reach
  • 5. Size really mattersPause & Watch DialingWandhttp://moto.ly/dialingwand
  • 6. Key Point #1Choose your target devices
  • 7. Android 1.5? QVGA? Global? As of November 2010, developer.android.com
  • 9. Comparing resolution DROID X480 x 854 Normal DROID PRO320 x 480 Normal FLIPOUT320 x 240 Small
  • 10. Comparing resolution DROID XHigh240 dpi DROID PROMedium160 dpi FLIPOUTLow120 dpi
  • 11.
  • 12. Key Point #2Start with a fewsimple guidelines.
  • 13. Pause the slides & watch the PhotoDemo video on YouTube
  • 14. Adjust your AndroidManifestfor versions and screen sizes.
  • 15. <uses-sdk android:minSdkVersion= "7" android:targetSdkVersion= "8" />
  • 16. <supports-screens android:largeScreens= "true" android:normalScreens="true" android:smallScreens="true" android:anyDensity="true" />
  • 17.
  • 18. Test thoroughly on your targetSdkVersion
  • 19.
  • 20.
  • 23. Low 1 dip = 0.75 pixels High 1 dip = 1.5 pixels Medium 1 dip = 1 pixel What’s a DIP? A pixel that changes size
  • 24. Pause the slides & Watch the RelativeLayout video on YouTube
  • 25. Use one set of images andlet Android scale them, for now. But we’ll look at this more later.
  • 26.
  • 27. Key Point #3 Add custom resources as needed, but watch performance.
  • 28. Add custom layouts, if you need them.But you might not.
  • 29.
  • 30.
  • 31. Custom resource sets for low, medium, and high density?
  • 32. Target the most commonly used density?
  • 33.
  • 34.
  • 35. 150% for high 100% for normal 75% for low
  • 36. Memory vs file size PhotoOne 32 MBmemory 324 KB size PhotoThree 23 MBmemory 728 KB size
  • 37. In other words Autoscaling uses memory.Custom image sets increase file size.
  • 38. What happens if you load a really big image into a small view?
  • 39. You might get No image Or a memory error
  • 40. Your application UI can behave differently across devicesor in different conditionsdue to memory
  • 41. Pause the slides & Watch the handling images video on YouTube
  • 42. private Bitmap loadBitmap() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int screenDensity = metrics.densityDpi; BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = false; options.inSampleSize = 4; options.inScaled = true; options.inTargetDensity = screenDensity; Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.clover, options); return bitmap; }
  • 43. If you need to detect density at runtimeandroid.util.DisplayMetricsis cool
  • 44. Pause the slides &Watch the detecting device density video on YouTube
  • 45. 240 and 1.5 120 and 0.75 160 and 1.0
  • 46. public void checkDensity() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); String logical_density = Float.toString(metrics.density); Log.e (TAG, "Logical density is " + logical_density); // for API level 4 (Android 1.6) and forward String screen_density = Integer.toString(metrics.densityDpi); Log.e (TAG, "Screen density is " + screen_density); }
  • 47. Key Point #4 Touch and gesture are key. Make sure they’re density independent too.
  • 48. Pause the slides &Watch the buttons video on YouTube
  • 49. <ImageButton android:id="@+id/button" android:src="@drawable/button" android:clickable="true" android:layout_gravity="center_vertical|center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:padding="40dip" />
  • 50. 16 pixels 3.3 mm 1.7 mm 2.5 mm
  • 51. private static final float DISTANCE_DIP = 16.0f; private static final float PATH_DIP = 40.0f; // convert dip measurements to pixels final float scale = getResources().getDisplayMetrics().density; scaledDistance = (int) ( DISTANCE_DIP * scale + 0.5f ); scaledPath = (int) ( PATH_DIP * scale + 0.5f );
  • 52. Okay .. Remember the key points?
  • 53.
  • 54. Start with a few simple guidelines.
  • 55. Add custom resources as needed, but watch performance.
  • 56.
  • 57.
  • 58. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • 59. Neither the name of the Motorola, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Other source code displayed in this presentation may be licensed under Apache License, Version 2
 Copyright © 2010, Android Open Source Project. All rights reserved unless otherwise explicitly indicated.
 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. DROID is a trademark of Lucasfilm Ltd. and its related companies. Used under license.