在我的应用程序中,我必须为通知设置一个大图标.LargeIcon必须是一个Bitmap,我的drawables是矢量图像(Android中的新功能,请看这个链接)问题是当我尝试解码一个矢量图像的资源时,我得到一个null返回.
以下是代码示例:
if (BitmapFactory.decodeResource(arg0.getResources(), R.drawable.vector_menu_objectifs) == null)
Log.d("ISNULL", "NULL");
else
Log.d("ISNULL", "NOT NULL");
Run Code Online (Sandbox Code Playgroud)
在这个例子中,当我用一个"普通"图像替换R.drawable.vector_menu_objectifs,例如一个png例如,结果不为空(我得到正确的位图)是否有我缺少的东西?
我尝试更改Chrome自定义标签中的关闭按钮的默认图标(CustomTabsIntent.Builder)
简单的测试代码:
Bitmap closeIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
intentBuilder.setCloseButtonIcon(closeIcon);
Run Code Online (Sandbox Code Playgroud)
但没有任何反应.为什么?(Nexus 7,Marshmallow)
我正在尝试更改 Chrome 自定义选项卡中关闭按钮的图标。但它并没有改变。
这是我的代码:
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setCloseButtonIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_arrow_back));
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));
Run Code Online (Sandbox Code Playgroud)