简体   繁体   English

“通知”后面的图片背景

[英]Image background behind “Notifications”

explain fast: problem: put image in background behind list of notification... I tryied: with a bigpicture, but It isn't that I want to... 快速解释:问题:将图像放在通知列表后面的背景中...我试过:带有大图片,但这不是我想要的...

Well, I saw a apps that have a notification custom, like this below... 好吧,我看到了一个具有通知自定义功能的应用,如下所示...

在此处输入图片说明

在此处输入图片说明

I want a custom background, but i don't know how to do this, i found other examples, but i explain how to change the notification, like custom, background, buttons, icon,etc. 我想要一个自定义背景,但是我不知道该怎么做,我找到了其他示例,但是我解释了如何更改通知,例如自定义,背景,按钮,图标等。 but i don't found a specific solution... 但我没有找到具体的解决方案...

links that i found: 我发现的链接:

android lollipop notification background colour Android棒棒糖通知背景颜色

Change Notification Layout 更改通知布局

I will apretiate you help. 我会为您提供帮助。

Is it a media controller app? 它是媒体控制器应用程序吗?

Because: The solution you want only works for applications that have registered itself as a media controller, so apps that don't play audio can't/shouldn't use this mechanism to change the lockscreen wallpaper. 因为:您想要的解决方案仅适用于已将自己注册为媒体控制器的应用程序,因此,不播放音频的应用程序不能/不应使用此机制来更改锁屏墙纸。

/**
* Set up the remote control and tell the system we want to be the default receiver for the MEDIA buttons
* @see http://android-developers.blogspot.fr/2010/06/allowing-applications-to-play-nicer.html
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void setUpRemoteControlClient() {
Context context = VLCApplication.getAppContext();
AudioManager audioManager = (AudioManager)context.getSystemService(AUDIO_SERVICE);

if(Util.isICSOrLater()) {
    audioManager.registerMediaButtonEventReceiver(mRemoteControlClientReceiverComponent);

    if (mRemoteControlClient == null) {
        Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
        mediaButtonIntent.setComponent(mRemoteControlClientReceiverComponent);
        PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context, 0, mediaButtonIntent, 0);

        // create and register the remote control client
        mRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
        audioManager.registerRemoteControlClient(mRemoteControlClient);
    }

    mRemoteControlClient.setTransportControlFlags(
            RemoteControlClient.FLAG_KEY_MEDIA_PLAY |
            RemoteControlClient.FLAG_KEY_MEDIA_PAUSE |
            RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
            RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
            RemoteControlClient.FLAG_KEY_MEDIA_STOP);
} else if (Util.isFroyoOrLater()) {
    audioManager.registerMediaButtonEventReceiver(mRemoteControlClientReceiverComponent);
    }
}

This part is to update artwork, among other info: 这部分是更新艺术品,以及其他信息:

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void updateRemoteControlClientMetadata() {
if(!Util.isICSOrLater()) // NOP check
    return;

if (mRemoteControlClient != null) {
    MetadataEditor editor = mRemoteControlClient.editMetadata(true);
    editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, getCurrentMedia().getAlbum());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, getCurrentMedia().getArtist());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_GENRE, getCurrentMedia().getGenre());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, getCurrentMedia().getTitle());
    editor.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, getCurrentMedia().getLength());
    editor.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, getCover());
    editor.apply();
}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM