什么是存储访问XML在Android的最佳方式?方式、XML、Android

由网友(蹲街弑ゝ潇洒、)分享简介:虽然我知道自己的资源在XML文件中定义的,如果我有我自己的类型,我希望用一个XML文件,我应该将它们存储在RES / XML?While I realize resources themselves are defined in XML files, if I have an XML file of my own t...

虽然我知道自己的资源在XML文件中定义的,如果我有我自己的类型,我希望用一个XML文件,我应该将它们存储在RES / XML?

While I realize resources themselves are defined in XML files, if I have an XML file of my own type that I wish to use, should I be storing them in "res/xml"?

有没有更好的方式来做到这一点,如使用的资产,然后加载它们为二进制被另一个XML库解析?

Is there a better way to do this such as using assets and then loading them as binary to be parsed by another XML library?

推荐答案

我会与添加XML资源内部的 RES 文件夹中有特定的资源类型去。它的,我已经适应了,具有用于组织在同一目录下我的所有文件的约定。

I would go with adding the XML resource inside the res folder with the specific resource type. Its a convention that I have adapted to, having all my files in the same directory for organization.

如果您在 RES / XML 它可以随时在运行时通过Resources.getXML()

If you add your XML file inside of res/xml it can be accessed anytime at run-time via Resources.getXML()

阅读全文

相关推荐

最新文章