DigitalClock 数字时钟有什么方法设置成任意时间?
难道只能显示系统时间么?Android

解决方案 »

  1.   

     @Override
        protected void onAttachedToWindow() {
            mTickerStopped = false;
            super.onAttachedToWindow();
            mHandler = new Handler();        /**
             * requests a tick on the next hard-second boundary
             */
            mTicker = new Runnable() {
                    public void run() {
                        if (mTickerStopped) return;
                        mCalendar.setTimeInMillis(System.currentTimeMillis());
                        setText(DateFormat.format(mFormat, mCalendar));
                        invalidate();
                        long now = SystemClock.uptimeMillis();
                        long next = now + (1000 - now % 1000);
                        mHandler.postAtTime(mTicker, next);
                    }
                };
            mTicker.run();
        }
    这个是网上的,setText里面的内容不是可以随便改的吗?