我正在使用 PlayerNotificationManager
用于在我的应用程序中显示播放通知。一切正常,但我想在通知中使用自定义字体添加我的应用程序 Logo 。
我通过添加 drawables.xml
更改了通知上的播放和暂停按钮.但是找不到更改字体的方法。
那么,如何更改 Exoplayer 提供的默认通知布局和特性呢?
编辑:
我看过this Github 上的问题说我们需要扩展 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);
}
最佳答案
正如 repo 中所说,您需要扩展 PlayerNotificationManager
为此,您需要创建 class并复制项目中的所有内容,然后按照 link 中的说明添加要使用的布局
您需要在 builder
中添加您的布局here
关于android - 如何在 Exoplayer 通知中设置自定义布局和字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64377201/