在Android通知全宽图像 [英] Full width image in android notification

查看:125
本文介绍了在Android通知全宽图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在通知中添加全幅图像我的申请。

I need to add full width image in the notification for my application.

我由JSON有效载荷中发送URL做到这一点,加载位图和成功的图像加载我显示通知。

I do it by sending the URL in the json payload, load the bitmap and on successful image loading I show the notification.

我的问题是什么是最好的最佳图像分辨率

My question is what is the best optimum resolution of the Image

请帮帮忙!

先谢谢了。

推荐答案

您图像的宽度应等于在屏幕的下拉通知栏的宽度是相同的宽度。

The width of your image should be equal to the width of the screen as the width of the dropdown notification bar will be the same.

在为了做到这一点,你需要做到这一点:

In order to do that you need to do this:

DisplayMetrics metrics = context.getResources().getDisplayMetrics();
int width = metrics.widthPixels;

这样做后,你可以设置的值INT宽度你的形象。

这篇关于在Android通知全宽图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆