【问题标题】:Setting bitmap as content icon in wearable notification将位图设置为可穿戴通知中的内容图标
【发布时间】:2015-01-13 12:11:17
【问题描述】:

我正在使用下面的代码在磨损中生成通知。

new Notification.WearableExtender()
.setBackground(BitmapFactory.decodeResource(context.getResources(), R.drawable.example_big_picture))
                     .setContentIcon(R.drawable.image)
                     .setContentIconGravity(Gravity.START)) 

但setContentIcon 只能用于设置可绘制图像。有没有办法将bitmap 设置为内容图标(我从服务器获取位图)。或者有没有其他方法可以达到同样的效果?任何帮助,将不胜感激。提前致谢。

【问题讨论】:

    标签: android android-notifications wear-os


    【解决方案1】:

    将位图转换为可绘制对象

    Drawable d = new BitmapDrawable(getResources(),bitmaphere);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多