【开源】CropImageView

CropImageView

使用说明:

添加依赖

Gradle

dependencies {
   compile 'com.cesards.android:cropimageview:1.0.1'
}

Maven

<dependency>
   <groupId>com.cesards.android</groupId>
   <artifactId>cropimageview</artifactId>
   <version>1.0.1</version>
   <type>aar</type>
</dependency>

xml中定义

<com.cesards.cropimageview
   xmlns:custom="http://schemas.android.com/apk/res-auto"
   android:id="@+id/imageView1"
   android:src="@drawable/photo1"
   custom:crop="value" />

其中alue可以的取值是topLeft|centerLeft|bottomLeft|topRight|centerRight|bottomRight|centerTop|centerBottom

或者用代码设置

CropImageView cropImageView = new CropImageView(CropActivity.this);
final Resources res = getResources();
cropImageView.setImageDrawable(res.getDrawable(images[position]));
final CropImageView.CropType cropType = imageCrops[position];
cropImageView.setCropType(cropType);

posted on 2015-04-28 10:00  wasdchenhao  阅读(780)  评论(0)    收藏  举报

导航