2011-07-21 35 views

回答

2

創建custom Notification,並把這樣的事情在你的notification_layout.xml文件:

<ProgressBar 
    android:layout_width="fill_parent" 
    android:layout_height="15dp" 
    android:id="@+id/notificationLoadingBar" 
    android:progressDrawable="@android:drawable/progress_horizontal" 
    android:indeterminate="false" 
    android:indeterminateOnly="false" /> 

保持對它的引用您的Notification(使它全球),並設置使用RemoteView進度的API。

示例代碼:

mNotification.contentView.setProgressBar(R.id.notificationLoadingBar, 
    max, progress, false); 
+0

非常感謝你,我的作品,現在我想以我的更新進度條來創建我的服務類中的線程。你知道我怎麼能創建一個服務類的線程。謝謝... – Tim

+0

@Tim:使用['AsyncTask'](http://developer.android.com/reference/android/os/AsyncTask.html) – Wroclai