2016-05-17 59 views
0

我將所需的可繪製設置爲Notification.Builder,但它說不能解決。我試圖使用ic_launcher這是行不通的,所以我添加了我自己的wuno_launcher,那也不管用。安卓設置圖標通知生成器

private Notification getNotification(String content) { 
     Notification.Builder builder = new Notification.Builder(this); 
     builder.setContentTitle("New Affirmation"); 
     builder.setContentText(content); 
     builder.setSmallIcon(R.drawable.wuno_launcher); // error here cannot resolve symbol 
     return builder.build(); 
} 

但我確定我已添加圖標,如下圖所示。

enter image description here

+1

你應該只將'ic_launcher'icons放置在'mipmap'文件夾中。將其他任何drawable移動到'drawable'文件夾中(例如'drawable-xhdpi') –

+0

好的,謝謝我會試試 – wuno

回答

3

如果使用紋理貼圖文件夾圖像,所以你必須使用紋理貼圖,而不是繪製下文稱。做這樣的事情

builder.setSmallIcon(R.mipmap.wuno_launcher) 
+0

Thanks man。所以這就是ic_launcher無法工作的原因。所以對於我的自定義圖像,我會放在drawable中。但ic_luancher只是使用你的答案。 – wuno

+0

不客氣。 – Masum