Couldn't expand RemoteViews 错误及解决

本文介绍了解决Android应用中自定义通知栏视图导致的RemoteServiceException问题的方法。通过替换自定义控件为标准控件,如将RoundedImageView替换成ImageView,并将View替换成TextView,从而避免了RemoteViews的支持限制。

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

在写通知栏的时候遇到如下错误

android.app.RemoteServiceException: Bad notification posted from package com.cootek.smartdialer: Couldn't expand RemoteViews 


原因:

使用了自定义控件

<com.makeramen.roundedimageview.RoundedImageView
    android:src="@drawable/icon_dialer"
    android:layout_width="32dp"
    android:layout_height="32dp"
    android:layout_gravity="center_vertical"
    android:layout_marginLeft="14dp" />

以及
<View
    android:layout_width="1px"
    android:layout_height="24dp"
    android:layout_gravity="center_vertical"
    android:background="#d8d8d8" />


因为RemoteViews  支持的控件数量有限

将com.makeramen.roundedimageview.RoundedImageView 改为ImageView

将View 改为TextView


问题解决。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值