Freitag, 19. November 2010

Tag 2: 09:30 - 12:30 - Dive into Android

Der Vortrag wurde von Romain Guy und Chet Haase vorgetragen, wobei Romain „Layouts“ und Chet „Graphics“ vorgetragen hat. Der Vortragstil war eine Mischung aus Präsentations-Slides und Live-Coding-Demos.

Layouts-Facts
Layout und bzw. die View-Beschreibung erfolgt bei Android in XML.
  • Layouts sind wichtig aufgrund der verschiedenen Displaysgrößen
  • Layouts sind nicht pluggable
  • Layout extends ViewGroup
  • Parameter sind Kindelement des Layouts (im XML)
Absolutes/Fixes Layout
Feste Masseinheiten: dip,px etc.

Wichtig:
  • match the parent's size
  • Parameter: MATCH_PARENT bedeutet „big as parent“
  • best fit: WRAP_CONTENT
Es stehen darüber hinaus vier Layouts zur Wahl
  • FrameLayout
  • LinearLayout
  • RelativeLayout
  • TableLayout

Die sogenannte Layout-Geometry bzw. das Box-Layout kam mir bekannt vor. Ähnlich wie beim CSS gibt es margin und padding. Die „gravity“, die Position innerhalb der Box, war mir neu.
Romain meinte, das das Liniear Layout das meist genutzte Layout ist. Außerdem solle man nicht zu viele Layouts schachteln.

RelativeLayout
  • care at Version 1.5

Table Layout
  • no Table-Widget just layout

Tools
Hierarchieviewer als Debug-Tool
Stellt die Hierarchie des Layouts dar.
  • nicht in Eclipse integriert
  • Funktioniert nicht für Enduser-Phones
  • Feature: Export als Photoshop-File => COOOL

Part 2 : Graphics and Animations
Custom Views and Containers für Coole Effekte (Spiegel etc.)

Allgemeines:
How = Paint
What = Canvas
Where = Bitmap, Surface

Paint
  • Stroke props- width,color
  • Fill props- gradient
  • Quality - anti-aliasing, dithering, bitmap scaling

Canvas
Verbunden mit dem Destination

Bitmaps
  • images
  • rendering buffer
  • creation
  • drawing to
  • drawing from

Tip: „reuse objects for performance“

Graphical effects
  • rich background
  • alpha ramps
  • 3d light effeccts
  • Gradiend effect

Animation Effects
Help user understand whats happening
  • transition between states
  • indicate actions and consecuences
  • indicates changes in state

Optimize Techs
mobile not desktop
  • slow cpu's
  • less memomory

opt: bitmaps
  • pre-scale
  • cache complex rendering
  • create bitmaps in device depth

others
  • avoid garbage
  • make background view opague
  • avoid re-creating objects
  • dont over-invalidate
  • avoid costly operations on the UI thread -> AsyncTask is your friend
  • reduce layout nesting
  • avoid costly rendering during animatgionans -> do it fast, max. half sec.

Tools
  • traceview for profiling
  • hierarchyviewert container visualization
  • layoutopt - static analysis on xml-files as extra tool

Romain: http://www.curious-creature.org/category/android/

Chet: http://graphics-geek.blogspot.com/

android-developer site: http://developer.android.com

Keine Kommentare:

Kommentar veröffentlichen