zoukankan      html  css  js  c++  java
  • handler.postDelayed()和timerTask

    public static void scrollToListviewTop(final XListView listView)

        {

            listView.smoothScrollToPosition(0);

            final Handler handler = new Handler();

            handler.postDelayed(new Runnable()

            {

                @Override

                public void run()

                {

                    if (listView.getFirstVisiblePosition() > 0)

                    {

                        listView.smoothScrollToPosition(0);

                        handler.postDelayed(this, 100);

                    }

                }

            }, 100);

        }

    public class TimeTaskScroll extends TimerTask {

            

            private XListView listView;

            

            public TimeTaskScroll(XListView listView){

                    this.listView = listView;

            }

     

            private Handler handler = new Handler() {

                    public void handleMessage(android.os.Message msg) {

                            listView.smoothScrollToPosition(0); 

                    };

            };

     

            @Override

            public void run() {

                    Message msg = handler.obtainMessage();

                    handler.sendMessageDelayed(msg, 2000);

            }

     

    }

    new TimerTask().run();

  • 相关阅读:
    Ucenter会员整合
    站点收藏
    天天团购整理笔记一
    MSSQLSERVER 时间差计算
    shell 编程实例练习(一)
    Linux PCI 设备驱动基本框架(二)
    Shell grep / sed 学习
    转:Python自省(反射)指南
    Shell 数组与双括号
    Python基本数据生成
  • 原文地址:https://www.cnblogs.com/yaya-Android/p/4528060.html
Copyright © 2011-2022 走看看