Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Many Devices, One Application > Uncovering the Secrets of the res/ Folder

Uncovering the Secrets of the res/ Folder

Earlier, I gave you a basic mapping of what goes where in the res/ folder. In this section, I’ll show you its more advanced functions. As always, you can either code this yourself or follow along from the sample code posted at Peachpit.com/androiddevelopanddesign.

Layout Folders

The layout folders are the source of the first tool at your disposal, and it’s one of the best. Android will, if configured correctly, pick layout files from a folder that matches the hardware configuration closest to the one it’s running on. Using this tool, you can define multiple screen layouts for any number of different hardware configurations. Let’s start with something simple: landscape mode.

Let’s say you have a simple screen with two buttons. Let’s take a look at the layout XML that produced the two buttons.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint