Android download progress notification layout not found?
I need to display the download progress in the notification area (like the Market does). I found several examples, all of them using the XML layout android.R.layout.download_progress. All the examples look great and simple to implement. The issue is, android.R.layout.download_progress does not seem to exist! It will not show up in Eclipse's intellisense, it 开发者_开发技巧won't compile, and even the official Android documentation (sorry, can't provide a link because I'm a new member) does not have this field. So why does it show up in multiple examples online? Am I missing something? I'd really prefer to not have to reinvent the wheel here.
Thanks in advance.
You're not really reinventing the wheel. It's a really simple declaration.
<ProgressBar android:id="@+id/progress"
android:padding="5dp"
android:layout_width="200dp"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_below="@+id/currentlyplaying_songimage"
style="@android:style/Widget.ProgressBar.Horizontal"
android:max="100"/>
Now just, instead, use R.layout.progress_file_name
It's probably not much help to you since you most likely want to run on older phones too, but there's a new API in ICS that makes this super easy: Notification.Builder.setProgress()
.
精彩评论