【问题标题】:View thums images with GridView, scrolling is very slow用GridView查看thums图片,滚动很慢
【发布时间】:2013-03-14 08:59:37
【问题描述】:

目前我正在接受培训,我正在开发一个在线文件管理应用程序。 当我尝试使用拇指显示许多图像(100 个图像或 200 个)时,滚动出现问题 GridView 滚动非常长。

我从我为小图像设置的可绘制和布局参数的服务器下载图像,这是我的代码:

public void openImageWithCache(boolean loopTry, final ImageView iconView,
        final LayoutParams layoutParams, final View v, final Node o) {
    //if (v.getTag() == previewT){
    try {
        String prefix = (true ? "thumb_mini" : "");


        File cacheFile = new File(AjaXplorerApplication.getCacheFolder(),
                (prefix) + previewT.getUuidPath());
        if (cacheFile.exists()) {



            iconView.setImageDrawable(Drawable.createFromPath(cacheFile
                .getPath()));
            iconView.setLayoutParams(layoutParams);
            //iconView.invalidate();
            //loopTry = true;
            return;
            }

【问题讨论】:

  • String prefix = (true ? "thumb_mini" : ""); 没用 prefix 将永远等于 "thumb_mini" -> String prefix = "thumb_mini";
  • 斜体 粗体 Thank's i corrected that but i have the same problem with scrolling it still very very slow.

标签: java android gridview scroll


【解决方案1】:
  1. 拇指图像是否很大?如果是这样,请将它们最小化到您可以的最小尺寸。

  2. adapter的getView方法中,如果view不为null,不调用new,根据位置改变图片即可。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多