資料內(nèi)容:
PRIORITIZING ALTERNATIVE RESOURCES
Given the many types of configuration qualifiers for targeting
resources, there may be times when the device configuration
will match more than one alternative resource. When this
happens, qualifiers are given precedence in the order shown in
the list above.
To see this prioritizing in action, add another alternative
resource to CriminalIntent – a longer English version of the
crime_title_hint string resource – to be displayed when
the current configuration’s width is at least 600dp. The
crime_title_hint resource is displayed in the crime title
text box before the user enters any text. When CriminalIntent
is running on a screen that is at least 600dp (such as on a
tablet, or perhaps in landscape mode on a smaller device), this
change will display a more descriptive, engaging hint for the
title field.
Create a new values resource file called strings. Follow the
steps from the section called Localizing Resources earlier in
this chapter to create the resource file, but select Screen Width in
the Available qualifiers list and click the >> button to move ScreenWidth to the Chosen qualifiers section. In the Screen width box that
appears, enter 600. The directory name will automatically be
set to values-w600dp; -w600dp will match any device where
the current available screen width is 600dp or more, meaning a
device may match when in landscape mode but not in portrait
mode. (To learn more about screen size qualifiers, read the
section called For the More Curious: More on Determining
Device Size near the end of this chapter.) Your dialog should
look like Figure 17.8.