gridview的getChildAt隐藏字段 [英] Gridview getChildAt hidden fields
问题描述
我有问题的GridView Android中。
I have issue with Gridview in Android.
上下文:
我有一个GridView,与下载(约100张图像)图像的列表。
Context : I have a gridview, with a list of images downloaded (around 100 images).
要做到这一点用户更方便,第一gridview的是负载,里面有100张图片上这是一个标志加载。
在那之后,我开始一个AsyncTask的是:
在与gridview.getChildAt onProgressUpdate =>更新图像
在onPostExecute =>下载与位图的列表GridView控件的更改适配器
To do it more convenient for user, a first gridview is load, with inside 100 images on which is a logo Loading. After that, I start an AsyncTask that : In onProgressUpdate => Update image with gridview.getChildAt In onPostExecute => change adapter of gridview with the list of bitmaps downloaded
我的问题是onProgressUpdate。
当使用getChildAt(位置),我意识到那个位置是指在可见矩形项目的位置。因此,有两个问题:
=>首先,隐藏的图像不被更新(这就是为什么我在做一个PostExecute setAdapter)
=>第二,如果我滚动同时下载,忘记它的第一印象,以及其他一些问题,同时滚动,但难以用字前preSS ...
My issue is in onProgressUpdate. When using getChildAt(position), I realized that position means position of the item in the visible rect. So there is two issues : => First, hidden images are not updated (it's why I'm doing an setAdapter in PostExecute) => Second, if I scroll while downloading, it forget the first images, and some other issues while scrolling, but difficult to express with word ...
我的问题是有点容易,但我并没有在Android的参考找到,而且也经过谷歌搜索:
- ?这怎么可能由它的实际位置来更新在GridView的视图,而不是由醒目的位置。
My question is a little easy, but I didn't find in Android Reference, and also after Google searches : - How is it possible to update a view in a gridview by its real position, and not by visible position ?
非常感谢
推荐答案
视图不可见不存在,所以不能对其进行更新。您只能更新您的支持模式对一旦用户滚动到特定项目的正确信息。所以,你需要做的是检索图像,并将它们保存在高速缓存(或模型本身)渲染的特定视图时,您可以访问。
Views that are not visible do not exist, so you can't update them. You can only update your backing model to have the correct information once the user scrolls to a particular item. So what you need to do is to retrieve the images and save them in a cache (or the model itself) that you can access when rendering a particular view.
不过,我认为没有必要检索用户没有看到还没有任何图像。
However, I would suggest that there's no need to retrieve any images the user is not seeing yet.
这篇关于gridview的getChildAt隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!