我曾经在gradle中将应用程序名称定义为资源:
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "lelisoft.com.lelimath"
resValue 'string', 'app_name', 'LeliMath'
}
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue 'string', 'app_name', 'LeliMath DEV'
}
}
然后我发现需要本地化,因此我resValue
从gradle中删除了所有内容,并在中定义了strings.xml
:
app\src\debug\res\values\strings.xml
<string name="app_name">LeliMath DEV</string>
app\src\main\res\values\strings.xml
<string name="app_name">Leli Math</string>
app\src\main\res\values-cs\strings.xml
<string name="app_name">Leli Matematika</string>
当我在Studio中编译应用程序时,它将显示Leli Matematika。我期待着LeliMath DEV。这个答案https://stackoverflow.com/a/37579475/1639556启发了我。
您可以通过在此处放置字符串来获取它。
app\src\debug\res\values-cs\strings.xml
<string name="app_name">LeliMath DEV</string>
希望能帮助到你:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句