### 一、demo功能
listview 列表倒计时,类似商品抢购列表
### 二、代码介绍
1.功能
实现每个item 倒计时功能,不会因为复用产生错位,以及数据的错乱,解决了图片每次刷新时闪烁问题
2.使用
Adapter文件:
//开启倒计时功能
public void start() {
isPlay = true;
runnable.run();
}
//关闭倒计时功能
public void stop(){
isPlay = false;
}
private Runnable runnable = new Runnable() {
@Override
public void run() {
if (!isPlay)
return ;
handler.postDelayed(this, 1000);
notifyDataSetChanged();
}
};
每秒刷新一次导致部分手机在图片加载时出现闪烁的情况,需要进行下处理:
id设置tag,当图片加载地址相同时,这不刷新,不同时,加载图片;
if (listposter.get(position).equals(viewHolder.iv_poster.getTag(R.id.iv_poster))) {
} else {
// 如果不相同,就加载。现在在这里来改变闪烁的情况
Glide.with(context).load(listposter.get(position)).diskCacheStrategy(DiskCacheStrategy.SOURCE).placeholder(R.drawable.ic_launcher).into(viewHolder.iv_poster);
viewHolder.iv_poster.setTag(R.id.iv_poster,listposter.get(position));
}
主activity
加载adapter,开启倒计时
adapter = new LimitAdapter(this, listtime,listposter);
listview.setAdapter(adapter);
if (isstart){
//开启倒计时
adapter.start();
isstart=false;
}
在onPause()或者onDestroy()中,一定要记得关闭倒计时,调用stop();
没有合适的资源?快使用搜索试试~ 我知道了~
android listview列表实现倒计时,类似商品抢购列表
共93个文件
xml:27个
bin:12个
lock:9个
2星 需积分: 17 54 下载量 196 浏览量
2017-11-27
14:09:21
上传
评论
收藏 15.63MB ZIP 举报
温馨提示
实现listview 列表倒计时,类似商品抢购列表,,不会因为复用产生错位,以及数据的错乱,解决了图片每次刷新时闪烁问题
资源推荐
资源详情
资源评论
收起资源包目录
MyApplication.zip (93个子文件)
MyApplication
.gitignore 127B
gradle
wrapper
gradle-wrapper.jar 52KB
gradle-wrapper.properties 233B
local.properties 544B
README.md 2KB
build.gradle 521B
ListLimitDemo
build.gradle 552B
ListLimitDemo.iml 8KB
src
main
AndroidManifest.xml 924B
java
com
example
demo
TimeUtil.java 1KB
MainActivity.java 2KB
LimitAdapter.java 4KB
res
values
styles.xml 695B
strings.xml 229B
dimens.xml 218B
layout
activity_main.xml 364B
limit_buy_item.xml 3KB
drawable-xhdpi
ic_launcher.png 12KB
menu
main.xml 261B
build
outputs
logs
manifest-merger-debug-report.txt 4KB
generated
source
buildConfig
androidTest
debug
com
example
demo
test
BuildConfig.java 447B
debug
com
example
demo
BuildConfig.java 439B
aidl
androidTest
debug
debug
rs
androidTest
debug
debug
r
androidTest
debug
debug
com
example
demo
R.java 2KB
res
resValues
androidTest
debug
debug
rs
androidTest
debug
debug
intermediates
manifests
full
debug
AndroidManifest.xml 942B
instant-run
debug
symbols
androidTest
debug
debug
R.txt 667B
blame
res
androidTest
debug
debug
single
drawable-xhdpi.json 258B
menu.json 224B
layout.json 492B
multi
values.json 5KB
exploded-aar
com.android.support
support-v4
23.4.0
AndroidManifest.xml 852B
jni
libs
aidl
android
support
v4
os
ResultReceiver.aidl 675B
media
MediaMetadataCompat.aidl 680B
session
ParcelableVolumeInfo.aidl 689B
PlaybackStateCompat.aidl 688B
MediaSessionCompat.aidl 787B
RatingCompat.aidl 673B
annotations.zip 4KB
jars
libs
internal_impl-23.4.0.jar 316KB
classes.jar 1.02MB
res
assets
aapt
AndroidManifest.xml 852B
rs
androidTest
debug
obj
lib
debug
obj
lib
res
resources-debug.ap_ 14KB
merged
androidTest
debug
debug
values
values.xml 785B
layout
activity_main.xml 364B
limit_buy_item.xml 3KB
drawable-xhdpi
ic_launcher.png 9KB
menu
main.xml 261B
resources-debug-androidTest.ap_ 763B
manifest
androidTest
debug
AndroidManifest.xml 638B
tmp
incremental
mergeDebugResources
merged.dir
values
values.xml 785B
aapt-temp
compile-file-map.properties 795B
merger.xml 3KB
processDebugResources
aapt-temp
compileDebugAndroidTestAidl
dependency.store 5B
mergeDebugAndroidTestResources
merged.dir
aapt-temp
compile-file-map.properties 31B
merger.xml 736B
compileDebugAidl
dependency.store 5B
processDebugAndroidTestResources
aapt-temp
gradlew.bat 2KB
gradlew 5KB
.gradle
2.14.1
tasks
_task_compileDebugJavaWithJavac
localJarClasspathSnapshot
localJarClasspathSnapshot.bin 18KB
localJarClasspathSnapshot.lock 17B
localClassSetAnalysis
localClassSetAnalysis.lock 17B
localClassSetAnalysis.bin 24KB
_app_compileDebugJavaWithJavac
localJarClasspathSnapshot
localJarClasspathSnapshot.bin 26KB
localJarClasspathSnapshot.lock 17B
localClassSetAnalysis
localClassSetAnalysis.lock 17B
localClassSetAnalysis.bin 28KB
_yangtzeu-app-master_compileDebugJavaWithJavac
localJarClasspathSnapshot
localJarClasspathSnapshot.bin 19KB
localJarClasspathSnapshot.lock 17B
localClassSetAnalysis
localClassSetAnalysis.lock 17B
localClassSetAnalysis.bin 33KB
_ListLimitDemo_compileDebugJavaWithJavac
localJarClasspathSnapshot
localJarClasspathSnapshot.bin 19KB
localJarClasspathSnapshot.lock 17B
localClassSetAnalysis
localClassSetAnalysis.lock 17B
localClassSetAnalysis.bin 28KB
taskArtifacts
fileSnapshotsToTreeSnapshotsIndex.bin 83KB
cache.properties 31B
fileSnapshots.bin 3.74MB
cache.properties.lock 17B
fileHashes.bin 496KB
taskArtifacts.bin 360KB
build
generated
mockable-android-23.jar 22.2MB
gradle.properties 747B
.idea
libraries
glide_3_7_0.xml 522B
support_v4_19_1_0.xml 494B
runConfigurations.xml 564B
workspace.xml 209KB
misc.xml 3KB
modules.xml 403B
copyright
profiles_settings.xml 76B
compiler.xml 686B
gradle.xml 735B
MyApplication.iml 867B
import-summary.txt 2KB
settings.gradle 26B
共 93 条
- 1
资源评论
- 摩卡i2017-12-18不错的资源,很好
shan_zwq
- 粉丝: 73
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功