【发布时间】:2015-01-09 17:43:40
【问题描述】:
在我的代码中,我使用这个将字符串参数发送到 string.xml
String.format(getString(R.string.notification_devil_expire_coupon_for_one_user), "iphone", String.valueOf(loggedInUser.getExpiryReminder()));
在string.xml中我用这个来获取参数
<string name="notification_devil_expire_coupon_for_one_user">Do you even shop, bro? Your <xliff:g id="retailer">%s1</xliff:g> coupon expires in <xliff:g id="endDate">%s2</xliff:g> days.</string>
预期输出
Do you even shop, bro? Your iphone coupon expires in 3 days.
但我的输出是
Do you even shop, bro? Your iphone1 coupon expires in 32 days.
在字符串中添加参数编号。我不知道我在代码中哪里做错了
【问题讨论】:
标签: java android xml string string-formatting