NetworkImageView 设置默认图片
来源:互联网 发布:mac显示无电池 编辑:程序博客网 时间:2024/06/05 17:49
原文地址:http://stackoverflow.com/questions/21567055/display-networkimageviews-default-image-without-network-request
The problem is that even if a default image is set, it won't be displayed until one calls setImageUrl(), which in turn will set the source bitmap of the view to null if the url is empty. If the url isn't empty, it makes a request. This means that one is forced to make a network request even if there isn't a valid network url associated with that particular view, otherwise instead of displaying the default image it displays an empty view.
String url = getURL(); NetworkImageView niv = (NetworkImageView)rootView.findViewById(R.id.niv); if(url.length() > 0) niv.setImageUrl(url, imageLoader); niv.setDefaultImageResId(R.drawable._default); niv.setErrorImageResId(R.drawable.error);
需要最新版的 volley,旧版的存在bug,不能设置
可用volley jar 下载地址 http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mcxiaoke.volley%22
0 0
- NetworkImageView 设置默认图片
- NetworkImageView
- 设置页面默认图片
- imageView默认图片设置
- 默认图片设置
- Volley(二) ImageRequest、Imageloader、NetworkImageView加载图片
- 设置标签的默认图片
- 设置标签的默认图片
- vue.js 设置默认图片
- img图片不存在时设置默认图片
- Android Glide设置默认图片、异常图片为圆形图片
- Android结合volley的netWorkImageview实现图片文件缓存
- Android ListView异步加载图片乱序 使用NetworkImageView
- EXT默认空白图片路径设置
- Opencart2 后台设置图片的默认目录
- 导入图片时设置默认格式
- 导入图片时设置默认格式
- react-native image 设置默认图片
- centos redis安装
- iOS Xcode的智能提示功能有时莫名其妙失效
- 快速开发混凝土搅拌企业管理平台
- type命令
- Window服务与Quartz.NET
- NetworkImageView 设置默认图片
- 游戏开发性能优化经验总结
- head.s源码分析
- Mac 系统上安装Lua和SubmlimeText 编译器
- Location服务之LocationManager
- 1016. 部分A+B (15)
- 小技巧:absolute 元素的宽度问题
- C++primer 4.2 指针(上)
- 甘特图(xGantt)项目管理 - 多维企业级