How to add a notification type?

I want to add a single icon to the notification panel for a media player. Now when dragging the notification bar, I want to add a view, for example, four buttons.
How can i do this?

This feature is in the standard Android player. When the user leaves the screen, the player continues to play in the background, and when we drag the notification, there are functions for playback, pause, next and previous.

+3
source share
1 answer

This can be done using RemoteView. This developer.android.com article explains this pretty well: http://developer.android.com/guide/topics/ui/notifiers/notifications.html

RemoteView, , , ContentView . :

RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.custom_notification_layout);
contentView.setImageViewResource(R.id.image, R.drawable.notification_image);
contentView.setTextViewText(R.id.text, "Hello, this message is in a custom expanded view");
notification.contentView = contentView;

, MediaController . , . , .


, , , , . , Google , , , .
: http://www.google.com/codesearch/p?hl=en#J8HqCFe1rOo/src/com/android/contacts/ContactListItemView.java&q=Android%20ContactList&sa=N&cd=4&ct=rc

DontPressWithParentImageView. , . .

+3

Source: https://habr.com/ru/post/1792153/


All Articles