KO
|
EN
gitlite — search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
CropImageView
★ 17
Open GitHub ↗
抄的跟微信一模一样的选择图片裁剪功能,支持不同宽高比裁剪区域,旋转角度裁剪。
Download README (.md)
Explore Similar Repositories
Obsidian-Dark-Graphite-Pie-theme
:
custom-CSS for Obsidian app
TweetFromUnityWebGL
:
Mobile-ready script for tweeting from Unity WebGL.
auth-nestjs
:
🔐 Sistema de autenticação desenvolvido com NestJS
travel_anchors
:
travel anchors for modern versions (1.16+)
MdcMotion
:
No description available.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
CropImageView
?
Download (.md)
# CropImageView 仿微信图片裁剪功能,支持对图片两指缩放,旋转 图片裁剪成正方形 <img src="https://github.com/liaohailong190/CropImageView/blob/master/images/example01.gif" alt="科学上网 或 Github 加速器" width="224px"> 图片裁剪成长方形 <img src="https://github.com/liaohailong190/CropImageView/blob/master/images/example02.gif" alt="科学上网 或 Github 加速器" width="224px"> 使用方式:下载aar包,项目依赖比较快:https://github.com/liaohailong190/CropImageView/tree/master/aar <img src="https://github.com/liaohailong190/CropImageView/blob/master/images/example03.png" alt="科学上网 或 Github 加速器"> 在Activity中调用以下代码,调起图片裁剪界面 ```kotlin val uri = Uri.fromFile(this) // 资源图片uri val output = Uri.fromFile(generateImageFile()) // 输出图片uri val width = resources.displayMetrics.widthPixels // 输出宽度 px val height = (width * cropRatio).toInt() // 输出高度 px // 裁剪的宽高比例,通过width和height来控制->width/height val options: CropOptions = CropOptions.Factory.create( uri, output, width, height, Bitmap.CompressFormat.JPEG ) CropImageActivity.showForResult(this@MainActivity, options, REQUEST_CROP) ``` 在调起的Activitiy中复写onActivityResult函数,获取裁剪返回值 ```kotlin override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (resultCode == Activity.RESULT_OK) { when (requestCode) { REQUEST_CROP -> { data?.apply { var uri = getData() // uri is the crop result , do something you want... } } } } } ```