[U] Android UI – Tips & Tricks


Brief written observations which are important to remember and use, usually with an explanation and examples.

Tips & Tricks

Regarding Code:

  1. Use “wrap_content” and “match_parent”more
  2. Use RelativeLayout to eliminate complex, nested others layouts – more
  3. Use Size Qualifiers for example to ensure single-pane and two-pane view in different screen sizes (by res/layout/main.xml or res/layout-large/main.xml) – more
  4. Use the Smallest-width Qualifier – as previous, but layout is selected based on the smallest width of the screen (by res/layout-sw600dp/main.xml) – more
  5. Use Layout Aliases point 4 works only on Android 3.2 and above and to support previous versions use point 3, but content res/layout-sw600dp/main.xml and res/layout-large/main.xml should be the same, so extract it and inject by resources – more
  6. Use Orientation Qualifiers – map and inject as in point 4 to support different layouts depending orientation and screen size – more
  7. Use Nine-path Bitmaps (by tool draw9patch ) to provide resizable bitmaps – more, more

Regarding UX:

  1. In vertical recycler view use SnapHelper – SnapHelpermore


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s