Android 如何将通知按钮设置为图标而不是文字

Android 如何将通知按钮设置为图标而不是文字,android,xamarin,xamarin.android,android-notifications,Android,Xamarin,Xamarin.android,Android Notifications,这是我到目前为止理解通知的代码 Intent mIntent = new Intent(this, typeof(MainActivity)); Intent gIntent = new Intent(this, typeof(GameMenu)); Intent sIntent = new Intent(this, typeof(SceneMenu)); PendingIntent mainIntent = PendingInt

这是我到目前为止理解通知的代码

        Intent mIntent = new Intent(this, typeof(MainActivity));
        Intent gIntent = new Intent(this, typeof(GameMenu));
        Intent sIntent = new Intent(this, typeof(SceneMenu));

        PendingIntent mainIntent = PendingIntent.GetActivity(this, 0, mIntent, 0);
        PendingIntent gameIntent = PendingIntent.GetActivity(this, 0, gIntent, 0);
        PendingIntent sceneIntent = PendingIntent.GetActivity(this, 0, sIntent, 0);
        var notifSound = RingtoneManager.GetDefaultUri(RingtoneType.Notification);

        //long[] pattern = new long[] { 1000, 500, 1000, 2000, 3000, 500, 500, 1000};

        Notification n = new Notification.Builder(this)
                .SetContentTitle("RBOS Notification")
                .SetContentText("You won $1million")
                .SetColor(Color.LightGreen)
                //.SetVibrate(pattern)
                .SetPriority((int)NotificationPriority.Max)
                .SetShowWhen(true)
                .SetSound(notifSound)
                //.SetTicker(DateTime.Now.ToString("hh:mmtt"))
                .SetSmallIcon(Resource.Drawable.ic_fb)
                .SetContentIntent(mainIntent)
                .SetAutoCancel(false)
                .SetLights(Color.Green, 1000, 1000)
                .AddAction(Resource.Drawable.ic_main, "Main", mainIntent)
                .AddAction(Resource.Drawable.ic_play, "Game", gameIntent)
                .AddAction(Resource.Drawable.ic_scene, "Scene", sceneIntent).Build();

        NotificationManager notificationManager =
          (NotificationManager)GetSystemService(NotificationService);

        notificationManager.Notify(0, n);
我对如何将图标本身设置为通知而不是文字感到有点困惑。目标api为更高级别的jellybean。 在我的装有牛轧糖操作系统的华硕手机上,它只显示文字。在另一款手机Starmobile和OPPO中,它显示图标,但只显示部分文字。我想显示一些类似radio notif或vlc player notif的东西,只显示上一个播放/暂停下一个图标按钮(没有文字)


还有一个附带问题。股票代码有什么用?当我把它放在那里时,我看不到任何变化。同样在OPPO中,为什么通知没有立即出现(如电池电量不足时),即使在max中设置了优先级,标准通知也会在不同的API上出现差异(甚至在相同的API级别但不同的OEM之间也会出现差异)

您似乎想创建一个
RemoteView
,并将其用作通知的
CustomContentView
(就像通知抽屉中的媒体播放器一样)。这样,您可以使用自己的布局和内容覆盖默认通知模板

例子:
Resource.Layout.Alarm
布局仅包含一个
按钮
,因此通知仅是通知抽屉中的一个按钮:

var remoteView = new RemoteViews(PackageName, Resource.Layout.Alarm);
remoteView.SetInt(Resource.Id.myButton, "setText", Resource.String.rocks);

var notification = new Notification.Builder(this)
                   .SetSmallIcon(Android.Resource.Drawable.IcDialogInfo)
                   .SetCustomContentView(remoteView)
                   .Build();