问题
I have different strings.xml files in my resources folders (values, values_fr, values_de...), and I would like to load additional translations during runtime. Is it possible to add the new strings to those files even if it has already been compiled? Or is there a workaround?
回答1:
The simple answer is that you can't. You can't modify hard-coded stuff into APK resources.
But there are some options. For instance you can:
- Let's say read a resource, modify it, and save it into another external folder (SD card or so)
- Create AssetManager over those file(s)
- Then create Resources which can be later used as ordinary Android resource stored in APK
来源:https://stackoverflow.com/questions/4591696/how-do-i-generate-xml-resources-at-runtime-on-android