Custom UI for Android Wear Notifications

a 夏天 提交于 2019-12-17 21:17:48

问题


Hii I want to create Custom UI for android wear notification, and not AW app. Please suggest if there are any libraries or anything available for this.


回答1:


It is not available yet, most likely it will be in the future.

EDIT: Future is now. You can do this by passing own custom Activity by setDisplayIntent(), code sample:

public Notification buildNotification(Context context) {
            Intent displayIntent = new Intent(context, AnimatedNotificationDisplayActivity.class);
            displayIntent.putExtra(BasicNotificationDisplayActivity.EXTRA_TITLE, context.getString(nameResId));
            PendingIntent displayPendingIntent = PendingIntent.getActivity(context, 0, displayIntent, 0);
            return buildBasicNotification(context)
.extend(new Notification.WearableExtender()
.setDisplayIntent(displayPendingIntent))
.build();
}


来源:https://stackoverflow.com/questions/28603086/custom-ui-for-android-wear-notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!