当前位置:网站首页>The small icon of notification setting shows a small square
The small icon of notification setting shows a small square
2022-07-25 22:59:00 【Sharp surge】
Method 1 ( Modify the size and size of the icon ) ( Invalid ):
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.abc)
.setContentTitle("aaaaa")
.setContentText("bbbbbb")
.setLargeIcon(abcd);Called setSmallIcon() Method , But the small icon in the notification bar is a square , Not the icon we set ;
solve : The icon size is limited to 20kb within . ( Invalid )
Troubleshooting skills :
When the icon set is too large ,AndroidStudio The picture doesn't show up when previewing ;

Change to a small icon to display normally :

The small icon of this phone can show , But it's gray , It's not colored .( It's not completely solved )

Method 2 ( It works ):
Use different icons in different versions , stay android 8.0 following , Use icons with transparent backgrounds , Match with background color .
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
builder.setSmallIcon(R.mipmap.launcher_icon);
} else {
// A picture with a transparent background , Match with background color
builder.setSmallIcon(R.mipmap.icon_notification)
.setColor(Color.parseColor("#0972EE"));
}————————————————
Copyright notice : This paper is about CSDN Blogger 「 Donald 」 The original article of , follow CC 4.0 BY-SA Copyright agreement , For reprint, please attach the original source link and this statement .
Link to the original text :https://blog.csdn.net/zhijiandedaima/article/details/125007616
边栏推荐
- Von Neumann architecture
- Notification设置的小图标显示的是小方块
- recyclerview计算滑动距离之computeHorizontalScrollExtent-computeHorizontalScrollRange-computeHorizontalScrol
- How painful is it to write unit tests?
- Kibana~后台启动Kibana之后无法找到进程号
- Shanghai Second Polytechnic University - Health Daily autocheck
- 1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮
- Day006 select structure (if statement exercise)
- Node.js operation database
- Ribbon execution logic source code analysis
猜你喜欢

Use of qvariant
![[paper notes] robot dynamic tracking and grasping method based on online prediction and planning](/img/0f/ca7f3cd3332069185a2dad397766b4.png)
[paper notes] robot dynamic tracking and grasping method based on online prediction and planning

1000 okaleido tiger launched binance NFT, triggering a rush to buy

DOM event binding

1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮

CUDA environment construction

Matrixcube unveils the complete distributed storage system matrixkv implemented in 102-300 lines

CMU AI PhD first year summary

QT的Tree View Model示例

Kibana~ the process number cannot be found after kibana is started in the background
随机推荐
栈与Stack类
7-1 understand everything
Vs2019 WinForm clr20r3 error
Stack and stack class
Sichuan cuisine menu (I)
Session and cookie, token and storage
Qtreewidget control of QT
BIO、NIO、AIO的区别?
PE format: analyze and implement IATHOOK
QT string operation
Learning notes of technical art hundred people plan (2) -- vector
【接口性能优化】索引失效的原因以及如何进行SQL优化
CMU AI PhD first year summary
JS makes elements get or lose focus
Recommend short videos every week: more and more smart devices need collaboration, posing a greater challenge to the development of the Internet of things?
Oracle query statement summary
Common software shortcuts
Opencv compile and call GPU version
ribbon 执行逻辑源码解析
新媒体运营策略(以小红书为例)帮助你快速掌握爆款创作方法