2013-03-09 4 views
7

내가 애니메이션 android.R.drawable.stat_sys_upload로 내 알림 상태 표시 줄의 아이콘을 설정하기 위해 노력하고있어, 그것은 잘 작동하지만 아이콘이 애니메이션하지 않습니다안드로이드 - 쇼 애니메이션 상태 표시 줄 아이콘

private void showStatusNotification() { 

    NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 

    Builder notificationBuilder = new NotificationCompat.Builder(this); 
    notificationBuilder.setAutoCancel(false); 
    notificationBuilder.setOngoing(true); 
    notificationBuilder.setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this, 
      MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT)); 
    notificationBuilder.setContentTitle(getString(R.string.notification_title)); 
    notificationBuilder.setContentText(getString(R.string.notification_text)); 
    notificationBuilder.setSmallIcon(android.R.drawable.stat_sys_upload); 
    notificationManager 
      .notify(STATUS_NOTIFICATION_ID, notificationBuilder.build()); 
} 

답변

10

솔루션은 간단하지만 매우 까다 롭습니다. 추가하기 만하면됩니다.

notificationBuilder.setTicker(getString(R.string.notification_ticker)); 

마법이 발생하고 아이콘이 움직입니다. 이 버그 관련이있다 :

http://code.google.com/p/android/issues/detail?id=15657

가 누군가를 도움이되기를 바랍니다.

2

@ gingo의 답변을 추가하기 만하면 상태 표시 줄에 텍스트를 표시하지 않으려 고하기 때문에 notification_ticker 문자열을 strings.xml에 공백으로 두십시오 (매우 분명합니다). 당신이 진행 중이거나 다운로드 후 중지 애니메이션 아이콘을 원하는 경우

또한,/업로드 한 후 완료하여 notificationBuilder에 유사하게 보이는 아이콘을 설정하고이 같은 알림 관리자에서 방법을 알려 호출했다

mBuilder.setSmallIcon(R.drawable.ic_download); 
mNotifyManager.notify(0, mBuilder.build()); 
관련 문제