Image / Resize/Resample到144 x 144(使用大小方法“调整大小”而不是“重新采样”,否则图片将再次增加到每像素24色位(24 BPP)
File / Save as PNG,选中Show option dialog,选中Save Transparent Color,单击Save,然后单击图像中的黑色设置透明颜色
Android似乎只使用drawable-xxhdpi图像分辨率(144 x 144),因此将生成的ic_notification.png文件复制到\AndroidStudio\Projects\...\app\src\main\res\drawable-xxhdpi。在代码中使用.setSmallIcon(R.drawable.ic_notification),或者像Daniel Saidi上面建议的那样使用getNotificationIcon()。
defaultConfig {
applicationId "com.example.abdulwahidvi.notificationproblem"
minSdkVersion 16
//This is the version that was added by project by default
targetSdkVersion 26 <------ default
// Changed it to version 20
targetSdkVersion 20 <------ mine
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}