ImageView mImageView;
//wyn add
private void zoomPicture(String scale) {
if(mImageView == null){
return;
}
int width = (int)(mImageView.getWidth()*scale);
int height = (int)(mImageView.getHeight()*scale);
LayoutParams l = mImageView.getLayoutParams();
l.height = height;
l.width = width;
mImageView.setLayoutParams(l);
}
注:初始化刚完成时,做放大缩小操作会导致ImageView不显示,打Log发现mImageView.getWidth()和mImageView.getHeight()都是0,不知道为什么,所以如果在初始化完成时要做放大缩小动作,我就直接把with和herght写死了,这样就没事儿了