我們有一個Cordova-App,其中包含每個drawable-xy文件夾中的一個文件'icon.png'。我們使用OneSignal提供推送通知。通知按預期工作。除了小圖標。手機頂部欄上只有一個空白圖標,顯示應用程序符號。我試着用下面的代碼片斷:Android上未顯示OneSignal-Pushnotification小圖標
{
...
"small_icon" : "@android:drawable/icon.png"
....
}
我也嘗試過很多,很多沒有「Android」的其他變化的,沒有「繪製」,沒有斜線,與巴紐和無.png格式。等等,等等
我發現這個文檔中:(https://documentation.onesignal.com/reference#create-notification)
small_icon: stringOptional
Specific Android icon to use. If blank the app icon is used. Must be the drawable resource name.
的Android講述繪製資源:(https://developer.android.com/guide/topics/resources/drawable-resource.html)
隨着保存在RES圖像/繪製/ myimage.png ,這種佈局XML圖像適用於查看:
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/myimage" />
這應該是@drawable/icon
我呢。 (不起作用)
將大圖標更改爲網址適用於我,帶有可繪製的大圖標不適用。
這個屬性的正確用法是什麼small_icon
?
您的設備是不是棒棒糖? –
這不是預棒棒糖。我在5.0.2,5.1.1,6.0,硬件和仿真器設備上進行了測試。 –
小通知圖標用於所有版本的Android。從Lollipop 5.0開始,小圖標將被迫僅使用alpha通道,所有不透明部分將變爲白色。 – jkasten