在下载应用显示通知栏

在下载应用显示通知栏

本文介绍了安卓:在下载应用显示通知栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示一个通知栏,当一个应用程序被下载的Andr​​oid系统。我想作为一个表明,当一个应用程序从市场上下载吧是相同的。任何帮助吗?

I want to show a notification bar when an application is being downloaded in Android. I want the bar to be the same as the one showed when an application is downloaded from market. any help please?

推荐答案

我觉得这个链接可以帮助你:<一href="http://united-$c$crs.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android" rel="nofollow">http://united-$c$crs.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android

I think this link can help you: http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android

这是在 download_progress (并更改进度条的风格,用自己的安卓progressDrawable

This is the download_progress (and to change the style of the progress bar, use your own 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>

这篇关于安卓:在下载应用显示通知栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 12:47