[英]Is there a way that I can set buildConfigField value from build.gradle to view directly in layout xml file?
Let's say I set some buildConfigField
for my specific flavor in my build.gradle file, for example: 假设我在build.gradle文件中为我的特定风格设置了一些
buildConfigField
,例如:
...
productFlavors{
stage {
buildConfigField 'String', 'HOST_URL', '"https://someurl.com"'
....
}
} }
I would like to set, not programmatically, text in TextView in my layout xml that belongs to this flavor to this value. 我想在我的布局xml中将TextView中的文本设置为此值,而不是以编程方式设置。 How can I do that?
我怎样才能做到这一点?
Use: 采用:
resValue "string", "whatever", '"your string literal goes here"'
in each of your flavors. 在你的每一种口味中。 Then, refer to
R.string.whatever
in your layout. 然后,请参阅布局中的
R.string.whatever
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.