当前位置:网站首页>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
边栏推荐
- PCL basic operation Encyclopedia
- MatrixCube揭秘102——300行实现的完整分布式存储系统MatrixKV
- SSH服务器CBC加密模式漏洞(CVE-2008-5161)
- Deep recursion, deep search DFS, backtracking, paper cutting learning.
- Can generic types be used in array
- Qt的TQTreeWidget控件
- Anaconda~Upload did not complete.
- 721. Account consolidation ●●, and collection
- Network Security Learning (11) scanning and blasting
- MathType installation and solution cannot solve the problem of crtl+v
猜你喜欢
![[training day13] backpack [dynamic planning] [greed]](/img/a7/3df395d84f510dea8b42ebcc4ff5f2.png)
[training day13] backpack [dynamic planning] [greed]

单元测试,写起来到底有多痛?

Deep recursion, deep search DFS, backtracking, paper cutting learning.

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

QT operation to solve large amount of duplicate data
![[MySQL rights] UDF rights (with Malaysia)](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[MySQL rights] UDF rights (with Malaysia)

互联网协议之 IPFS

Qt的TQTreeWidget控件

Design of Butterworth filter and drawing of amplitude frequency characteristic curve

Kibana~ the process number cannot be found after kibana is started in the background
随机推荐
CUDA environment construction
CMU AI PhD first year summary
[PTA] 7-24 minimum fraction (15 points)
ribbon 执行逻辑源码解析
CSV intro
JS makes elements get or lose focus
Opencv compile and call GPU version
汇编语言与微机原理实验一、实验二、实验三:分支程序设计/循环程序设计/子程序设计
为啥谷歌的内部工具不适合你?
1000 okaleido tiger launched binance NFT, triggering a rush to buy
Von Neumann architecture
invalid syntax
5 ROS仿真建模(3- rviz+gazebo+控制仿真机器人)
How to obtain the cash flow data of advertising services to help analyze the advertising effect?
Why should we launch getaverse?
We media people must have four material websites, and don't worry about finding materials anymore
Interview question 17.11. word distance ●●
MySQL data type
Hcie is finally in hand, and the road begins
依法严厉打击违规自媒体运营者:净化自媒体行业迫在眉睫