Notification的icon大小

来源:互联网 发布:手机移动数据自动连接 编辑:程序博客网 时间:2024/06/15 22:34

1Notification的Icon大小问题

问题描述:

我设置notification 的icon为一个png类型图片(大小49*49像素)

当我不设置notification 的tickerText的时候,一切正常。

如图


接下来当设置notification   tickerText之后,图片变成大图片 了。如图

上图是当tickerText 信息滚动时候图片变成这样了。


当信息滚动结束后,正常显示了


不知道什么原因导致的?有碰到过得朋友给说下。

一下是显示notification代码 求指点

private void showNotificationOpenDialog(String text){                 Notification n = new Notification();        n.icon=R.drawable.icon;        n.tickerText=Html.fromHtml(text);        n.when=System.currentTimeMillis();                 n.flags |= Notification.FLAG_SHOW_LIGHTS;        n.flags |= Notification.FLAG_AUTO_CANCEL;        n.flags |= Notification.FLAG_ONGOING_EVENT;         n.defaults = Notification.DEFAULT_SOUND;             Intent i = new Intent(this, DialogActivity.class);         i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);        i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);           Bundle b = new Bundle();          b.putString("content", text);         i.putExtras(b);                     // Simply open the parent activity        PendingIntent pi = PendingIntent.getActivity(this, 0,          i,0);        // Change the name of the notification here        n.setLatestEventInfo(this, NOTIF_TITLE, Html.fromHtml(text), pi);         mNotifMan.notify(NOTIF_CONNECTED, n);                        }


参考:

1 图片文件我是新建的文件夹。把图片放到新建的文件夹里。把文件移动到系统默认建立的drawable-hdpi 问题解决!(用ic_launcher验证出现同样的问题,新建文件夹,或移动到drawable-hdpi 文件夹就能解决,我不相信。)

2 对于Notification的Icon来说, 必须要符合Android UI设计规范,如上面的链接,icon大小必须是24*24像素dp,否则,将会出现各种显示不全,图标忽大忽小的现象。(使用这个验证,不出问题了;验证时,发现手机里的LBE的通知图标也是这样大)


0 0
原创粉丝点击