0
알림 바에서 애니메이션을 제어 할 수 있습니까?알림 바에서 애니메이션을 구동
그릴 수 xml 파일 : /drawable/tracker_animation.xml
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/user_location_on" android:duration="1000" />
<item android:drawable="@drawable/user_location_on_blick" android:duration="1000" />
</animation-list>
및 알림 빌더로 설정 :
은이 코드를 사용하여 간단한 깜박임을 할 수 있었다NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.tracker_animation);
이제 애니메이션을 제어하고 싶습니다. 예를 들어 새로운 좌표가있을 때만 그것을 실행하십시오. 또는 좌표를 서버에 보냅니다.
나는android:oneshot="true"
를 설정하고 내가 원하는 경우 수동으로 시작 애니메이션 애니메이션 드로어 블 AnimationDrawable을 얻을 싶어요. 는 다른 뷰를 위해이 같은 일을 :
ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image);
img.setBackgroundResource(R.drawable.spin_animation);
// Get the background, which has been compiled to an AnimationDrawable object.
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
// Start the animation (looped playback by default).
frameAnimation.start();
하지만이 NotificationManager
에서 나는 그것이 잘못된 방향이었다이 목적을 위해 애니메이션의 .getBackground()