展会信息港展会大全

android imageView 显示ico格式图标文件
来源:互联网   发布日期:2015-10-03 11:21:05   浏览:2979次  

导读:imageview显示ico图标需要兜一个圈子在此贴出代码 [Java]代码String p = Environment.getExternalStorageDirectory() + ...

imageview显示ico图标需要兜一个圈子在此贴出代码

[代码] [Java]代码

String p = Environment.getExternalStorageDirectory() + "/ico/ifeng.ico";

String p2 = Environment.getExternalStorageDirectory() + "/ico/ifeng.png";

FileInputStream fis = null;

FileOutputStream fos = null;

try {

fis = new FileInputStream(p);

fos = new FileOutputStream(p2);

} catch (FileNotFoundException e) {

e.printStackTrace();

}

Bitmap bmp = BitmapFactory.decodeStream(fis);

bmp.compress(Bitmap.CompressFormat.PNG, 0, fos);

Drawable d = Drawable.createFromPath(p2);

ImageView topleftimage = (ImageView) findViewById(R.id.topleftimage);

topleftimage.setImageDrawable(d);

赞助本站

人工智能实验室

相关热词: ico 图标 imageView

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港