Created
October 20, 2014 23:34
-
-
Save yushiro/a19d9d587e958a71e0f7 to your computer and use it in GitHub Desktop.
ImageView的裁剪
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(45, 45)); imageView.setAdjustViewBounds(false); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); | |
setScaleType的ScaleType.CENTER_CROP, 从图片的中央开始裁剪, 具体的ScaleType说明可以参考http://blog.sina.com.cn/s/blog_407abb0d0100mao1.html setAdjustViewBounds必须设置为false, 而且需要指定ImageView的layout_height, layout_width |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment