
小视图
http://ww2.sinaimg.cn/large/0060lm7Tjw1evltz17djrj30f00qomxy.jpg
大视图
http://ww2.sinaimg.cn/large/0060lm7Tjw1evltz1k2ssj30f00qo0to.jpg
stackoverflow 上面倒是有一个很像这种
http://stackoverflow.com/questions/27209596/media-style-notification-not-working-after-update-to-android-5-0
但是好像只能在 android 5.0 以上版本才能用。。。
1 ruobe OP 在 android5.0 上面的效果 | /tr>
2 lj3lj3 Aug 31, 2015 这不就是一个 ExpandableNotification 么?还是我忽略了重点 |
3 inoris Aug 31, 2015 Applying an expanded layout to a notification: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#ApplyStyle 要求版本 4.1 以上。 |
5 ruobe OP |
6 ruobe OP |
7 inoris Aug 31, 2015 @ruobe 你要的效果应该是 http://developer.android.com/design/patterns/notifications.html#ongoing_notifications 代码在 http://developer.android.com/guide/topics/ui/notifiers/notifications.html#controllingMedia 要兼容到 4.1 的话,用 NotificationCompat 代替就好。 http://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html |
8 ruobe OP @inoris 并不能用 NotificationCompat.Builder 代替,只能使用 Notification.Builder ,无法支持 5.0 以下版本。 In Android 5.0 (API level 21 ) the lock screen no longer displays media controls based on the RemoteControlClient... balabala...... Note: The template and the addAction () method are not included in the support library, so these features run in Android 5.0 and higher only. |
9 ruobe OP |
10 duguguiyu Sep 1, 2015 这其实和 ongoing 什么没有关系。首先如果大视图就要 4.1 以上的版本,如果是需要做出图片那样,需要用自定义的 RemoteViews 就 OK 。 |