Figuring out location of ImageView in a 2D array
Is there a way to find the location开发者_StackOverflow中文版 of a specific imageView given an ID in a 2D array? For example if I have ImageView [x][y] and each of the ImageViews has an ID, is it possible to find the specific [x][y] of an Image given that I know the ID of the ImageView I'm looking for?
You'd have to iterate through and testing each ImageView using getId().
If performance is a problem then you could build an index using HashMap with keys as ids and values as (x, y)
pairs.
精彩评论