Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在整数数组中调用集合 R.drawable 的序列,以便以后可以选择访问它。但我想动态加载到对应于不同名称的 R.drawable。它的名称需要是根据外部值输入没有硬编码。我尝试了很多但喜欢使用列表、集合、数组转换等。请在这方面用一个片段或示例指导我。谢谢。
我想,实现此功能的最佳方法是使用Integer的ArrayAdapter。
您只需按 id 添加可绘制资源。
如果您需要获取资源 id,但您会从用户那里获得字符串输入,您可以使用以下代码:
Android,从字符串中获取资源ID?