集图像,随机在网格中的Andr​​oid [英] Set images randomly in the grid in Android

查看:160
本文介绍了集图像,随机在网格中的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个版本的Andr​​oid开发者网站上的网格视图的例子:的 http://developer.android.com/resources/tutorials/views/hello-gridview.html 我想显示在实现电网随机的图像位置将在每次点击更改图片。是否有人可以给出这是如何实现的例子(即什么需要进行编辑)?谢谢!

I am using a version of the "Grid View" example from the Android Developers site: http://developer.android.com/resources/tutorials/views/hello-gridview.html And I would like to display images in reach grid randomly and the image position will change in each click. Can someone please give an example of how this might be accomplished (i.e. what needs to be edited)? Thanks!

推荐答案

您需要实现一个自定义的 ListAdapter ,在这里你需要检查哪些项目是可见的,然后选择一个随机的图像,该图像是不可见的。弼注意,总共随机列表会混淆用户。更好地随机图像进行排序,并在一个事例相同visualizate他们。

You need to implement a custom ListAdapter, where you need to check which items are visible and select then a random image which is not visible. Bute note that a total random list will confuse your users. Better sort your images by random and visualizate them same in one instance.

这篇关于集图像,随机在网格中的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆