V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ruobe
V2EX  ›  Android

网易云音乐这种通知栏怎么实现?

  •  
  •   ruobe · 2015-08-31 16:07:28 +08:00 · 9122 次点击
    这是一个创建于 3158 天前的主题,其中的信息可能已经有所发展或是发生改变。
    12 条回复    2015-09-01 14:23:45 +08:00
    ruobe
        1
    ruobe  
    OP
       2015-08-31 16:13:29 +08:00   ❤️ 1



    在 android5.0 上面的效果
    lj3lj3
        2
    lj3lj3  
       2015-08-31 18:47:11 +08:00   ❤️ 1
    这不就是一个 ExpandableNotification 么?还是我忽略了重点
    inoris
        3
    inoris  
       2015-08-31 18:51:04 +08:00   ❤️ 1
    Applying an expanded layout to a notification: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#ApplyStyle

    要求版本 4.1 以上。
    ruobe
        4
    ruobe  
    OP
       2015-08-31 19:22:38 +08:00
    @lj3lj3 重点就是你实现过吗?
    ruobe
        5
    ruobe  
    OP
       2015-08-31 19:30:07 +08:00
    @inoris
    http://localhost/docs/training/notify-user/expanded.html
    虽然有点像,但是还差的远
    ruobe
        6
    ruobe  
    OP
       2015-08-31 19:30:50 +08:00
    ruobe
        8
    ruobe  
    OP
       2015-08-31 19:57:04 +08:00
    @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.
    duguguiyu
        10
    duguguiyu  
       2015-09-01 14:04:29 +08:00
    这其实和 ongoing 什么没有关系。首先如果大视图就要 4.1 以上的版本,如果是需要做出图片那样,需要用自定义的 RemoteViews 就 OK 。
    ruobe
        11
    ruobe  
    OP
       2015-09-01 14:22:46 +08:00
    @duguguiyu 像 google play music 那样的通知我会,是比较常规向的。但是网易云音乐那个太变态了,从小视图切到大视图后,图片和按钮还有移动效果。。。
    ruobe
        12
    ruobe  
    OP
       2015-09-01 14:23:45 +08:00
    @duguguiyu 现在唯一的问题就是那个移动效果了,其他的都 OK 了,用的就是 RemoteViews ,支持 4.1 版本以上
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4845 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 03:57 · PVG 11:57 · LAX 20:57 · JFK 23:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.