文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > android自定义ImageView实现缩放,回弹效果
侵权投诉

android自定义ImageView实现缩放,回弹效果

} else if (mode == ZOOM) {

if(spacing(event)>10f)

{

afterLenght = spacing(event);

float gapLenght = afterLenght -

beforeLenght;

if(gapLenght == 0) {

break;

}

//图片宽度(也就是自定义imageView)必须大于70才可以缩放

else if(Math.abs(gapLenght)>5f&&getWidth()>70) {

if(gapLenght>0) {

this.setScale(scale,BIGGER); }else {

this.setScale(scale,SMALLER); }

beforeLenght = afterLenght; //这句不能少。 }

}

}

break;

}

return true;

}

private void setScale(float temp,int flag) {

if(flag==BIGGER) {

//setFrame(left , top, right,bottom)函数表示改变当前view的框架,也就是大小。

this.setFrame(this.getLeft()-(int)(temp*this.getWidth()),

this.getTop()-(int)(temp*this.getHeight()),

this.getRight()+(int)(temp*this.getWidth()),

this.getBottom()+(int)(temp*this.getHeight()));

}else if(flag==SMALLER){

this.setFrame(this.getLeft()+(int)(temp*this.getWidth()),

this.getTop()+(int)(temp*this.getHeight()),

上一页第7页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email