Like you wants to do it, following the answer of CommonWare, it is not possible. But you can do in another way: For my whitelabels products Ive created a file called branding.xml (inside of the values folder) where in this file I set up all the things that i need to take care when i am building different products from my root project. (you can called this file with the name that you wish of course. This file has to be also included into the root project).
I am going to start showing you a small piece of my gradle file, ok?
signingConfigs {
rootproject{
storeFile file("rootprojec_keystore") //Path to the keystore file
keyAlias "aliasname"
storePassword "xxxxxxxxx"
keyPassword "xxxxxxx"
}
whitelabel1 {
storeFile file("whitelabels/whitelabel1_keystore") //Path to the keystore file
keyAlias "whitelabel_1"
storePassword "xxxxxxxx"
keyPassword "xxxxxxx"
}
}
productFlavors {
rootproject{
applicationId = "com.rootproject.android"
signingConfig = signingConfigs.rootproject
}
whitelabel1{
applicationId = "com.whitelaber1.android"
signingConfig = signingConfigs.whitelabel1
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src','test']
resources.srcDirs = ['src','test']
aidl.srcDirs = ['src','test']
renderscript.srcDirs = ['src','test']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
whitelabel1{
res.srcDirs = ['whitelabels/whitelabel1/res']
}
}
In the last block (sourceSets) is where you have the key. For my whitelabels I am using a full res folder but you could even use only the file i think like: whitelabels/whitelabel1/res/values/branding.xml
Ok? Now we know how the compiler is going to use a different file/folder for you whitelabel.
Well, now we are going to describe the branding.xml files:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="kind_font">assets/fonts/nameofthefont.ttf</integer>
</resources>
You must create the same file in your root project and the whitelabel one, chaning the value of the font, of course.
Ok, one elegant way to use custom fonts along to your app is using a custom text view so you must follow the instructions here, it is pretty easy:
http://www.techrepublic.com/article/pro-tip-extend-androids-textview-to-use-custom-fonts/
And now finally the line of code where you have to access to the variable with the name of the font that you want to load. In the last manual there is the line:
Typeface myTypeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/"+fontName);
and you should modify with the name of the variable described into the branding.xml file:
String fontName = ((String)getResources().getString(R.bool.kind_font)
and that's all...hahaha...vote me if it was valid...and happy coding!