如何在 Exoplayer 通知中设置自定义布局和字体?

How to set custom layout and font in Exoplayer notification?

我正在使用 PlayerNotificationManager 在我的应用程序中显示播放通知。一切正常,但我想在通知中使用自定义字体添加我的应用程序徽标。

我通过添加 drawables.xml 更改了通知上的播放和暂停按钮。但是找不到更改字体的方法。

那么,如何更改 Exoplayer 提供的默认通知布局和特性?

编辑: 我在 Github 上看到 this 问题,它说我们需要扩展 PlayerNotificationManager 才能使用自定义布局。但我似乎无法让它工作。

这是我的代码:

 private void setPlayerNotificationManager(Player player) {


    playerNotificationManager = new PlayerNotificationManager(context, "123", 1234, mediaDescriptionAdapter);
    playerNotificationManager.setUseNavigationActions(false);
    playerNotificationManager.setUsePlayPauseActions(true);
    playerNotificationManager.setRewindIncrementMs(0);
    playerNotificationManager.setFastForwardIncrementMs(0);
    //playerNotificationManager.setColor(Color.GREEN);
    playerNotificationManager.setColorized(true);
    playerNotificationManager.setUseChronometer(false);
    playerNotificationManager.setSmallIcon(R.drawable.logo);
    playerNotificationManager.setPlayer(player);

}

如回购协议所述,您需要扩展 PlayerNotificationManager 才能做到这一点,您需要创建此 class and copy everything inside your project, and then add the layout you want to use as described in this link

您需要在 builder here

中添加布局