android图片大小缩放,安卓系统的桌面图片怎么缩放

1,安卓系统的桌面图片怎么缩放得桌面软件才可以,你去pchome上下个简单桌面,这款软件是专门管理桌面 。不知道您的意思是什么,以我用过的桌面来说,桌面图片在设定的时候可以控制大小,但是真正用起来的时候是全屏的,一般不能自定义让他放大缩小你是说壁纸吗? 如果是壁纸,设定的壁纸的时候,可以放大缩小选择框【android图片大小缩放,安卓系统的桌面图片怎么缩放】{0}
2,Android中压缩图片指定大小注意看这句话,bit.compress(CompressFormat.PNG, 100,baos); 那里的数字表示 如果不压缩是100,表示压缩率为0 。如果是70 , 就表示压缩率是70,表示压缩30%;所以你的倒数第二句话表示没有压缩 。以下是我压缩的方法,望采纳 。/*** 图像压缩并保存到本地* 返回处理过的图片**/ private Bitmap saveImage(String fileName,Bitmap bit)File file = new File(fileName);if (!file.exists())tryfile.createNewFile();} catch (IOException e)e.printStackTrace();}}tryByteArrayOutputStream stream = new ByteArrayOutputStream();bit.compress(CompressFormat.JPEG, 70, stream);// 70 是压缩率,表示压缩30%; 如果不压缩是100,表示压缩率为0FileOutputStream os = new FileOutputStream(file);os.write(stream.toByteArray());os.close();return bit;} catch (Exception e)file = null;return null;} }1. 自己处理bitmap2. 把屏幕分辨率上传,让后端处理返回适应大小的图片{1}
3,android等比例缩放图片的方法itmap icon = null;//原始图片int width = icon.getWidth(), height = icon.getHeight();float scaleRate = 0.8f;//缩小的比例while(width >= 300 || width >= 300)Matrix matrix = new Matrix();matrix.postScale(width * scaleRate, height * scaleRate);// 得到新的图片Bitmap newIcon = Bitmap.createBitmap(icon, 0, 0, width, height, matrix, true);icon.recycle();icon = newIcon;width = icon.getWidth(), height = icon.getHeight();}int width = icon.getWidth(), height = icon.getHeight();if(width > 300 || width > 300)float scaleRate = width > height ? 300 / width : 300 / height;Matrix matrix = new Matrix();matrix.postScale(width * scaleRate, height * scaleRate);// 得到新的图片Bitmap newIcon = Bitmap.createBitmap(icon, 0, 0, width, height, matrix, true);icon.recycle();icon = newIcon;}是介个意思吗?Bitmap icon = null;//原始图片int width = icon.getWidth(), height = icon.getHeight();float scaleRate = 0.8f;//缩小的比例while(width >= 300 || width >= 300)Matrix matrix = new Matrix();matrix.postScale(width * scaleRate, height * scaleRate);// 得到新的图片Bitmap newIcon = Bitmap.createBitmap(icon, 0, 0, width, height, matrix, true);icon.recycle();icon = newIcon;width = icon.getWidth(), height = icon.getHeight();}是介个意思吗github上面有一个PhotoView的开源项目 你可以试一试{2}

    推荐阅读