this is a big problem for me. i follow the solutions that i  searched from the internet: modify the listview layout and list-item layou file, 'wrap_content' to 'fill_parent'. but 'getView' function always was voked many time when the value of the 'position' is 0; i think it is maybe due to my complexed layout file.  so , i decide to give the a special way to load the data when 'position ' was 0; my solution like this:

if(position==0){
Bitmap bitmap = null;
if(imageFetcher.mImageCache!=null){
bitmap = imageFetcher.mImageCache.get(entity.getPath());
if(bitmap!=null){
holder.imageView.setImageBitmap(bitmap);
}else {
bitmap = FileImageUtil.getImageLocal(entity.getPath(), 100, 100);
if(bitmap != null){
imageFetcher.mImageCache.put(entity.getPath(), bitmap);
holder.imageView.setImageBitmap(bitmap);
}else {
holder.imageView.setImageResource(R.drawable.image_broken);
}
}
}
}else {
Log.d(TAG, "load position "+(position)+" ----- path "+entity.getPath()+" convertView "+convertView+" imageview " + holder.imageView);
imageFetcher.loadBitmap(entity.getPath(), (position), 100, 100, holder.imageView);
}

it works fine.

android: adapter getView(position==0) was invoked many times.的更多相关文章

  1. Android Adapter的几个方法

    1  ListView是在什么时候设置对Adapter的数据监听的? 在setAdapter(ListAdapter adapter)中,会先取消ListView中原来的mAdapter中的数据监听( ...

  2. Android ListView getView()方法重复调用导致position错位

    问题现状:Android ListView getView()方法重复调用导致position错位 解决办法:把ListView布局文件的layout_height属性改为fill_parent或者m ...

  3. [转]Android Adapter以及getView()方法的理解

    Android Adapter基本理解: 我的理解是: 1.一个有许多getter的类(就是getView(),getCount()....这些方法) 2.有多少个get方法?都是什么? 这些gett ...

  4. Android -- Adapter

    体系 public interface Adapter----0层(表示继承体系中的层次)  public interface ExpandableListAdapter---(无所谓层次因为没有其他 ...

  5. Android进阶(十四)Android Adapter详解

    Android Adapter详解 Android是完全遵循MVC模式设计的框架,Activity是Controller,layout是View.因为layout五花八门,很多数据都不能直接绑定上去, ...

  6. Android Adapter推荐写法

    package jason.fragmentdemo.adapter; import nqy.fragmentdemo.R; import nqy.fragmentdemo.model.Article ...

  7. Android Adapter基本理解

    感谢大佬:https://blog.csdn.net/l799069596/article/details/47301711 Android Adapter基本理解: 我的理解是: 1.一个有许多ge ...

  8. Android Adapter的getViewTypeCount和getItemViewType

    Adapter的getViewTypeCount和getItemViewType 不同的项目布局(item layout) 我们再举一个稍微复杂的例子,在上例的list中加入一些分隔线 你需要做这些: ...

  9. Android OpenGL ES 3.0 纹理应用

    本文主要演示OpenGL ES 3.0 纹理演示.接口大部分和2.0没什么区别,脚本稍微有了点变化而已. 扩展GLSurfaceView package com.example.gles300; im ...

随机推荐

  1. httpd 虚拟主机建立之访问机制及其日志定义

    注:关闭防火墙,selinux VirtualHost定义: 基于IP地址VirtualHost: 编辑httpd.conf文件: #DocumentRoot "/web/html" ...

  2. Orchard Oracle 支持

    Orchard v1.7发布了,非常不错的一个升级,为了支持Oracle,基本上和v1.6版差不多,只是工作流相关的表有名字超长问题,改个名就可以了,作了个patch包,发布在: https://or ...

  3. 意外作出了一个javascript的服务器,可以通过js调用并执行任何java(包括 所有java 内核基本库)及C#类库,并最终由 C# 执行你提交的javascript代码! 不敢藏私,特与大家分

    最近研发BDC 云开发部署平台的数据路由及服务管理器意外作出了一个javascript的服务器,可以通过js调用并执行任何java(包括 所有java 内核基本库)及C#类库,并最终由 C# 执行你提 ...

  4. [MSSQL2008]Spatial Data in SQL Server 2008 - 根据经纬度计算两点间距离

    DECLARE @BJ GEOGRAPHY DECLARE @XT GEOGRAPHY /*     GET Latitude/Longitude FROM here:http://www.trave ...

  5. 通过Anuglar Material串串学客户端开发 - NodeJS模块机制之Module.Exports

    module.exports 前文讲到在Angular Material的第二个编译文件docs/gulpfile.js中却看到了一个奇怪的东西module.exports那么module.expor ...

  6. grunt使用小记之开篇:grunt概述

    Grunt是什么? Grunt是一个自动化的项目构建工具.如果你需要重复的执行像压缩,编译,单元测试,代码检查以及打包发布的任务.那么你可以使用Grunt来处理这些任务,你所需要做的只是配置好Grun ...

  7. [ACM_水题] UVA 11729 Commando War [不可同时交代任务 可同时执行 最短完成全部时间 贪心]

    There is a war and it doesn't look very promising for your country. Now it's time to act. You have a ...

  8. C++ 泛型算法

    <C++ Primer 4th>读书笔记 标准容器(the standard container)定义了很少的操作.标准库并没有为每种容器类型都定义实现这些操作的成员函数,而是定义了一组泛 ...

  9. 使用Python的yield实现流计算模式

    首先先提一下上一篇<如何猜出Y combinator>中用的方法太复杂了.其实在Lambda演算中实现递归的思想很简单,就是函数把自己作为第一个参数传入函数,然后后面就是简单的Lambda ...

  10. paip.重装系统后firefox火狐收藏夹的恢复

    paip.重装系统后firefox火狐收藏夹的恢复 1.使用procmon跟踪ff保存收藏时候的读写文件.. D:\Users\attilax\AppData\Roaming\Mozilla\Fire ...