我想在Android下載應用程序時顯示通知欄。我希望酒吧與從市場下載應用程序時所顯示的相同。請幫忙嗎?Android:在下載應用程序時顯示通知欄
0
A
回答
3
這是download_progress(並更改進度條的風格,用自己的android:progressDrawable
)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="5dp">
<TextView android:id="@+id/status_text" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_alignParentTop="true"
android:text="@string/download_notification_message" />
<ProgressBar android:id="@+id/status_progress"
android:layout_width="fill_parent" android:layout_height="5dp"
android:layout_below="@id/status_text"
android:layout_marginTop="10dp"
android:progressDrawable="@drawable/notification_progress_bar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:indeterminate="false" android:indeterminateOnly="false" /> </RelativeLayout>
notification_progress_bar:
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#000001"
android:centerColor="#0b131e"
android:centerY="0.75"
android:endColor="#0d1522"
android:angle="270"
/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<gradient
android:startColor="#234"
android:centerColor="#234"
android:centerY="0.75"
android:endColor="#a24"
android:angle="270"
/>
</shape>
</clip>
</item>
<item
android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="#44000000"
android:centerColor="#44000000"
android:centerY="0.75"
android:endColor="#44000000"
android:angle="270"
/>
</shape>
</clip>
</item>
-2
試試這個代碼通知欄
void showProgress(String file_path){
dialog = new Dialog(DownloadFileDemo1.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.myprogressdialog);
dialog.setTitle("Download Progress");
TextView text = (TextView) dialog.findViewById(R.id.tv1);
text.setText("Downloading file from ... " + file_path);
cur_val = (TextView) dialog.findViewById(R.id.cur_pg_tv);
cur_val.setText("Starting download...");
dialog.show();
pb = (ProgressBar)dialog.findViewById(R.id.progress_bar);
pb.setProgress(0);
pb.setProgressDrawable(getResources().getDrawable(R.drawable.green_progress));
}
相關問題
- 1. 下載,顯示在通知欄?
- 2. 通知Android:當應用程序打開時不顯示通知?
- 3. 下載文件並在下載應用程序或通知中顯示在Cordova應用程序中
- 4. 下載到內部存儲器時在通知欄中顯示?
- 5. 從通知欄恢復我的android應用程序(並且應用程序圖標仍顯示在欄中)
- 6. 當應用程序在後臺顯示通知時不顯示
- 7. 在Java應用程序中顯示消息框或通知欄?
- 8. 在通知欄中顯示應用程序圖標
- 9. Android:不顯示通知,如果顯示的應用程序
- 10. Android:當應用程序關閉時顯示通知
- 11. Android顯示應用程序未打開時的通知?
- 12. Android - 如何停止顯示通知時打開應用程序
- 13. 如何在Android應用程序上顯示通知?
- 14. Android通知未顯示在應用程序中
- 15. 在ios中下載應用程序時的通知
- 16. 如何在離子混合應用程序中顯示通知下載進度?
- 17. 在Android應用程序中顯示應用程序的下載次數
- 18. 開始下載通知欄點擊android
- 19. 如何知道Android應用程序顯示或不顯示通知的應用程序狀態?
- 20. 在通知欄和活動中的多個下載顯示
- 21. 在設置中顯示通知 - >>應用程序 - >> XYZ應用程序 - >>顯示通知
- 22. 如何在應用程序運行時在通知欄中顯示分析推送通知?
- 23. 推送通知每次在應用程序啓動時顯示
- 24. 確定在點擊通知時是否顯示應用程序
- 25. 如何在應用程序關閉時顯示通知(iOS)?
- 26. FCM通知在應用程序終止時不顯示iOS
- 27. 防止在應用程序打開時顯示通知
- 28. 當應用程序在後臺時不顯示推送通知
- 29. Android編寫一個文件,顯示在下載應用程序
- 30. 當應用程序退出時顯示遠程通知的uiviewcontroller
歡迎計算器。下一次你需要展示你的一些作品或者你嘗試過的東西。請閱讀常見問題的「如何提出一個好問題」和http://WhatHaveYouTried.com。請只發布**一個**問題,如果需要,您可以編輯您的問題,而不是發佈兩個副本。 – Eonasdan
比你Eonasdan, – user1471575