Android Recipes A Problem-Solution Approach by Dave Smith, Erik Hellman

One option would have been to create three files with the same name and to place them in qualified directories, such as res/layout-land for landscape and res/layout-large for tablet. That scheme works great if each layout file is used only once, but we will need to reuse each layout in multiple configurations, so in this example we will create qualified aliases to these three layouts.

2, a new system based on the screen’s actual dimensions (in dp units) was introduced. With the new system, the following resource qualifiers are acceptable for physical screen sizes: • Smallest Width (resource-sw___dp): Screen with at least the noted densityindependent pixels in the shortest direction (meaning irrespective of orientation) • 30 A 640dp×480dp screen always has a smallest width of 480dp. Chapter 1 ■ Layouts and Views • Width (resource-w___dp): Screen with at least the noted density-independent pixels in the current horizontal direction • • A 640dp×480dp screen has a width of 640dp when in landscape and 480dp when in portrait.

Download PDF sample

Rated 4.00 of 5 – based on 42 votes