Как установить анимацию на значок уведомлений в Xamarin Android - PullRequest
0 голосов
/ 02 марта 2019

Я хочу установить анимацию на значок уведомления и показать, как значок отображается перед изображением (ось Z) * ​​1001 *

1 Ответ

0 голосов
/ 05 марта 2019

Согласно следующей ветке мы видим, что Android не позволяет изменять приложение.

Как отобразить количество уведомлений в значке панели запуска приложения

Но если вы все еще хотите использовать анимацию для уведомлений, я предлагаю вам реализовать анимацию для панели уведомлений Android.

Для этого требуется один 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());

Здесь та же тема, вы можетеВзгляните:

Как мигать значок уведомления в Android?[DONE]

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...