我正在尝试在我的最新Android项目(SDK9)中使用复数。但总是以ResourcesNotFoundException结束。但是资源肯定存在:
这是我的strings.xml的一部分:
<plurals name="count_files">
<item quantity="one">%d file</item>
<item quantity="other">%d files</item>
<item quantity="zero">%d files</item>
</plurals>
<plurals name="count_folders">
<item quantity="one">%d folder</item>
<item quantity="other">%d folders</item>
<item quantity="zero">%d folders</item>
</plurals>
这里是使用它的部分:
textView.setText(
getResources().getQuantityString(R.plurals.count_folders, countfolders, countfolders)
+ ", "
+ getResources().getQuantityString(R.plurals.count_files, countfiles, countfiles));
以下是异常信息:
android.content.res.Resources$NotFoundException: 复数资源 ID #0x7f050001 数量=0 项=other
我需要维护最多15种不同的语言,因此需要文本和复数形式的本地化。
请问我的代码有什么问题吗?
非常感谢您提前的帮助。