When you want to develop multiple devices for android, you need to prepare resources under multiple configurations. Of course, you also need to provide the default source. if the resources under multiple configurations are the same, you can copy the same resources to the corresponding directory. However, this is not a good practice. In fact, we can use the resource alias.
However, this method is not applicable to resources in the animation, menu, raw, and xml directories.
For icon.png images, res/drawable-en-rCA/and res/drawable-fr-rCA/configurations, the icon.png images are the same. in this case, you can change icon.png to a name such as icon_alais.png under the res/drawable directory, and then reference it in res/drawable-en-rCA/, res/drawable-fr-rCA/examples. in the generated R class, we use R. drawable. icon variable for Reference
Drawable
Use <bitmap> element to reference resources
Xml Code
<? Xml version = "1.0" encoding = "UTF-8"?> <Bitmap xmlns: android = "http://schemas.android.com/apk/res/android" android: src = "@ drawable/icon_ca"/>
Layout
Use the <include> and <merge> Elements
Xml Code
<? Xml version = "1.0" encoding = "UTF-8"?> <Merge> <include layout = "@ layout/main_ltr"/> </merge>
Strings and other simple values
Use resource id as reference
Xml Code
<? Xml version = "1.0" encoding = "UTF-8"?> <Resources> <string name = "hello"> Hello </string> <string name = "hi"> @ string/hello </string> </resources>
Xml Code
<? Xml version = "1.0" encoding = "UTF-8"?> <Resources> <color name = "yellow"> # f00 </color> <color name = "highlight"> @ color/red </color> </resources>
This article is from wen66"