[英]android studio does not find drawable icon
我正在嘗試在MAC上的android-studio 中進行開發,但遇到了一個奇怪的問題。 在活動代碼中,我無法引用位於mipmap文件夾中的圖像。 特別是我創建了一個通知:
...
Notification notify = new NotificationCompat.Builder(this)
.setContentTitle(title)
.setContentText(body)
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(startPendingIntent)
.build();
...
我收到錯誤“無法解析符號 ic_launcher”。 奇怪的是,我無法將圖標復制粘貼到空的drawable文件夾中。 我應該在哪里以及如何放置圖標以便在android studio的代碼中可見?
您需要使用R.mipmap.ic_launcher
訪問 drawable
關閉 Android Studio,然后打開 finder。 轉到項目目錄。 導航到項目的 mipmap 文件夾。 復制圖像,然后轉到 drawable 文件夾並將圖像粘貼到各自的分辨率文件夾中。 再次打開 android studio,它們應該在 drawable 文件夾中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.