[Code Snipper]图片轮换

 1 // 左右滚动算法,类似广告效果
 2 public void twinklingBasketGifProgress() {
 3     ProcessScreen processScreen=(ProcessScreen) Session.current.getNavigator().getCurrentScreen();
 4     final Handler twinkNameHandler = processScreen.getCurrentHandler();
 5     Runnable twinkNameTask = new Runnable() {
 6         private boolean isForward = true;
 7         private int twinkTimes = 0;
 8         @Override
 9         public void run() {
10             if (currentTwinklingIndex == twinklingBasketGif.length - 1) {
11                 isForward = false;
12             }else if (currentTwinklingIndex == 0){
13                 isForward = true;
14                 twinkTimes ++;
15             }
16             if (isForward) {
17                 currentTwinklingIndex++;
18             } else {
19                 currentTwinklingIndex--;
20             }
21             myTaskbarImage.setImageResource(twinklingBasketGif[currentTwinklingIndex]);
22             if (twinkTimes <= 2) {
23                 twinkNameHandler.postDelayed(this, 100);
24             }else {
25                 myTaskbarImage.setImageBitmap(defaultBasketIcon);
26                 currentTwinklingIndex = -1;
27             }
28             Log.e("", currentTwinklingIndex + ""); 
29         }
30     };
31     twinkNameHandler.postDelayed(twinkNameTask, 100);
32 }

posted @ 2012-05-07 11:23  席步川  阅读(231)  评论(0编辑  收藏  举报