一个简单的Android图片裁剪库:SimpleCropView
xcxc
9年前
一个简单的Android图片裁剪库:SimpleCropView。它简化了进行裁剪图像的代码,并提供易于定制的用户界面。
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView); final ImageView croppedImageView = (ImageView)findViewById(R.id.croppedImageView); // Set image for cropping cropImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.sample5)); Button cropButton = (Button)findViewById(R.id.crop_button); cropButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Get cropped image, and show result. croppedImageView.setImageBitmap(cropImageView.getCroppedBitmap()); } }); } }