我有 <CheckBox, ImageButton>
的 map .
我希望能够迭代此 map 并更改每个 ImageButton
的图像.有什么办法可以做到这一点? getValue()
似乎不让我使用与每个 ImageButton 关联的方法。
最佳答案
// support you define your hash map like this
HashMap<CheckBox,ImageButton> hs = new HashMap<CheckBox,ImageButton>();
// then
for(Map.Entry<CheckBox, ImageButton> e : hs.entrySet())
{
ImageButton imgBtn = e.getValue();
// do whatever you like to imgBtn
}
关于java - 迭代 java 映射并更改值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32040128/