I want to set animation on Notification Badge and how to display the badge infront of the imageview(Z axis)
Asked
Active
Viewed 468 times
1 Answers
0
According to the following thread, we can see that Android does not allow changing of the application.
How to display count of notifications in app launcher icon
But If you still want to animation for notification, I suggest you can implement animation for Android Notification bar.
It needs one animationfile.xml
<?xml version="1.0" encoding="utf-8" ?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/icaon" android:duration="10000" />
<item android:drawable="@drawable/ic_stat_button_click" android:duration="10000" />
</animation-list>
int icon = Resource.Drawable.animationfile;
// Build the notification:
var builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.SetAutoCancel(true) // Dismiss the notification from the notification area when the user clicks on it
.SetContentIntent(resultPendingIntent) // Start up this activity when the user clicks the intent.
.SetContentTitle("Button Clicked") // Set the title
.SetNumber(count) // Display the count in the Content Info
//.SetSmallIcon(Resource.Drawable.ic_stat_button_click) // This is the icon to display
.SetSmallIcon(icon)
.SetContentText($"The button has been clicked {count} times."); // the message to display.
// Finally, publish the notification:
var notificationManager = NotificationManagerCompat.From(this);
notificationManager.Notify(NOTIFICATION_ID, builder.Build());
Here is the same thread, you can take a look:

Cherry Bu - MSFT
- 10,160
- 1
- 10
- 16