【发布时间】:2011-11-02 02:09:43
【问题描述】:
我有一个从字符串数组资源填充的 ListView。 I'm trying to figure out how I can use a key-value type of structure, so that the key is displayed in the ListView, and when a row is selected I can get the value.
我知道我可以为值维护一个单独的数组并使用所选行的索引进行查找,但这很难维护。
另外我认为我可以使用我自己的自定义列表适配器创建一个 POJO 并使用这些对象构建列表,但如果可能的话,我想只使用一个简单的 xml 文件。
我正在阅读文档以查看是否可以在 xml 中执行此操作,但我还没有找到类似的内容?
感谢您的宝贵时间。
【问题讨论】: