重画
解决方案 »
- C#和android两个程序中如何生成同一个随机数序列?
- AndroidManifest.xml文件报错,等待高手
- 有人开发出android 手机关机能响的闹钟了吗?
- listview中的控件怎样动态赋值
- 触屏问题
- android 模拟器可以模拟wifi么?
- 字符串 问题 求帮忙
- Expandablelistview addFooterView一个view之后 怎么设置默认展开
- 求助!!!Eclipse添加ADT的时候老是错误,求大神指点!!!
- View.OnClickListener()被禁用,怎么办
- 不通过点击按键如何弹出系统菜单?
- 请教!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);