假设您有这样的formatted字符串:
<string name="saving">You saved %1$s with %2$s</string>
现在,如果您要检查TextView是否正确显示,那么类似的事情自然可以工作:
Espresso.onView(withId(R.id.tv))
.check(matches(withText(R.string.saving)))
但不是,我无法检查带有硬编码字符串的文本,因为它可能是另一种语言。所以有没有办法呢?
也许像: