重画
解决方案 »
- 求助关于DevicePolicyManager的问题
- The hierachy of the type (ClassName) is inconsistant.
- xml添加了发送短信权限,还是不能发送短信
- android的控件嵌套层次以多少层为宜?
- eclipse 如何导入新浪微博的java sdk
- app has no privilege to use this api
- Spinner初始化不触发onItemSelected
- android 有什么方法可以获取 路由器的牌子,比如说是TPLink,还是其他的?
- EditText高度动态变化
- 手机照相后获取照片并赋值给imageview的问题
- 不通过点击按键如何弹出系统菜单?
- 请教!android怎样自定义Spinner的菜单模式,只需要.xml文件就行
能否指出源码中实现的位置,谢谢
/* 设置图片缩小的比例 */
double scale=0.8;
/* 计算出这次要缩小的比例 */
scaleWidth=(float) (scaleWidth*scale);
scaleHeight=(float) (scaleHeight*scale);
/* 产生reSize后的Bitmap对象 */
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap resizeBmp = Bitmap.createBitmap(bmp,0,0,bmpWidth,
bmpHeight,matrix,true);
if(id==0) {
/* 如果是第一次按,就删除原来默认的ImageView */
layoutImage.removeView(mImageView);
} else {
/* 如果不是第一次按,就删除上次放大缩小所产生的ImageView */
layoutImage.removeView((ImageView)findViewById(id));
}
/* 产生新的ImageView,放入reSize的Bitmap对象,再放入Layout中 */
id++;
ImageView imageView = new ImageView(this);
imageView.setId(id);
imageView.setImageBitmap(resizeBmp);
layoutImage.addView(imageView);
Log.i(TAG, "imageView.getWidth() = " + imageView.getWidth()
+ ", imageView.getHeight() = " + imageView.getHeight());
setContentView(layout1);