android 仿微信通知栏,移动开发基础学习

本文介绍了在Android中如何使用NotificationCompat.Builder创建仿微信通知栏,包括设置图标、时间、颜色和自动取消功能。同时展示了如何根据网络图片URL获取Bitmap,并通过PendingIntent与Activity交互。讨论了程序员在技术发展快速的环境下,如何学习提升以达到高级工程师水平,特别是Android架构师所需掌握的技能,如Java、高级UI、性能优化、NDK和前沿技术等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(appContext)

.setSmallIcon(appContext.getApplicationInfo().icon)

.setSmallIcon(R.mipmap.icon_app_small)

.setWhen(System.currentTimeMillis())

.setColor(Color.parseColor("#4e60c4"))

.setAutoCancel(true);

if (friendListBean != null && !StringUtil.isBland(friendListBean.getHeadUrl())) {

mBuilder.setLargeIcon(GetImageInputStream(friendListBean.getHeadUrl()) == null ? BitmapFactory.decodeResource(

UIUtils.getContext().getResources(), R.mipmap.icon_logo) : GetImageInputStream(friendListBean.getHeadUrl()));

} else {

mBuilder.setLargeIcon(BitmapFactory.decodeResource(

UIUtils.getContext().getResources(), R.mipmap.icon_logo));

}

Intent msgIntent = appContext.getPackageManager().getLaunchIntentForPackage(packageName);

if (notificationInfoProvider != null) {

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值