【发布时间】:2021-08-18 10:39:54
【问题描述】:
【问题讨论】:
【问题讨论】:
在strings.xml 中定义字符串,不要在代码中硬编码。 “欢迎,%s”
然后在代码中使用:
getString(R.string.welcome_message).format(userProfile?.username)
【讨论】:
像这样声明你的字符串 Welcome %1$s 当你想使用它时
context.getString(R.string.welcome,userProfile?.username)
【讨论】: