2012-06-21 5 views
0

Android에서 응용 프로그램을 다운로드 할 때 알림 표시 줄을 표시하려고합니다. 응용 프로그램을 시장에서 다운로드 할 때 막대가 표시되는 막대와 동일하게하려고합니다. 어떤 도움을 주시겠습니까?Android : 응용 프로그램 다운로드 알림 표시

+0

환영 알림 표시 줄이 코드를 사용해보십시오. 다음에 당신은 당신의 일이나 시도한 것을 보여줄 필요가 있습니다. FAQ의 "좋은 질문을하는 방법"과 http://WhatHaveYouTried.com을 읽어보십시오. ** 질문 하나만 게시하십시오. 필요하다면 두 개의 중복 물을 게시하는 대신 질문을 편집 할 수 있습니다. – Eonasdan

+0

Eonasdan보다, – user1471575

답변

3

나는이 링크는 당신을 도울 수 있다고 생각 : http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android

이것은

<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 (진행률 표시 줄의 스타일을 변경하려면 자신의 android:progressDrawable 사용) DOWNLOAD_PROGRESS입니다 :

<?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

(210)에 유래하는

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)); 
    } 
관련 문제