我有类似以下代码行:
Notification notif = new Notification(R.drawable.notification_XX, "Notify", System.currentTimeMillis());
Run Code Online (Sandbox Code Playgroud)
我的问题是我想R.drawable.notification_XX改变,所以例如,如果我有一个变量,i = 24;那么R.drawable.notification_24应该使用适当的资源
那么,有没有一种动态创建可绘制资源路径的方法?
马丁,提前谢谢
如果要更改通知以显示数字,您只需设置对象的number字段,Notification相应的数字将覆盖在通知栏中的图标上.
但是,如果您确实有许多不同的图标,则可以使用该getIdentifier()方法Resources返回给定名称的资源ID.
| 归档时间: |
|
| 查看次数: |
1582 次 |
| 最近记录: |