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);