问题
When notifications from some applications are displaying on Samsung S8 Touchwiz there is a custom view with nice animation and ellipsized text. For example message notifications in Telegram.
Any ideas how to make my notification work like this on samsung? Tried all parameters in NotificationCompat.Builder but no success yet. Thanks.
It look's like this:
回答1:
I managed to figure out how you can make the notifications appear in such way on Samsung devices. The Samsung have "Edge lighting" setting. You can access it by sliding the quick settings menu from the top of the screen. When you enter the "Edge lighting" setting, make sure that "Show edge lighting" is set to "Always on". Also, go into "Details" and then "Manage notifications", to enable your application to show the notifications in such way. I noticed that some apps like Viber, WhatsApp and similar, were enabled by default. I don't know how you can influence that. Also for the notifications in my application, the category in code is set to HIGH. I don't know if this matter though, but I think it is worth mentioning. If someone knows how can we set our application to be enabled to show edge lighting notifications by default, like some apps do, please share.
来源:https://stackoverflow.com/questions/46847679/android-samsung-custom-notification-heads-up-view