滚动效果

来源:互联网 发布:淘宝客服招聘猪八戒网 编辑:程序博客网 时间:2024/05/16 14:27
public void musicTimerTask(){ if(playTimerTask != null){ playTimerTask.cancel(); } if(playTimer != null){ playTimer.cancel(); } curStr = mMusicName; oldStr = " " + mMusicName + " "; playTimerTask = new TimerTask(){ public void run(){ len = oldStr.length(); if(index > len){ index = 0; } newStr = oldStr.substring(index) + oldStr.substring(0, index); index++; if(index >= len){ index = 0; } views.setTextViewText(R.id.TextView01, newStr); appManager.updateAppWidget(thisWidget, views); } }; playTimer = new Timer(true); playTimer.schedule(playTimerTask, 0,1000); }
原创粉丝点击