开发者

Figuring out location of ImageView in a 2D array

开发者 https://www.devze.com 2023-02-15 17:38 出处:网络
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 poss

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消