问题描述
有没有一种方法可以在Android资源中使用字典.我在String.xml文件中找不到有关字典的任何内容,而可搜索文件还有许多我不需要的其他字段.
Is there a way to use dictionary in android resources. I couldn't find anything in String.xml file about dictionary and searchable file has many other fields that I don't need.
在C#和Visual Studio中,我们可以将字典以及字符串或整数添加到资源中,但是,我找不到将字典添加到资源的任何选项,并且仅在字符串和字符串数组或整数上可用android资源.
Edited: in C# and visual studio we can add dictionary to the resources as well as string or int, however, I couldn't find any option for adding dictionary to the resources and only string and string array or integer are available on android resources.
推荐答案
没有这样的资源类型.您必须将任意文件放在res/raw/中,然后手动将其导入到HashMap中.
There is no such a resource type. You have to put an arbitrary file in res/raw/ and import it manually in a HashMap.
这篇关于Android资源中的字典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!