我正在使用此示例裁剪从库中选择的图像,但问题是该示例仅裁剪正方形.是否可以裁剪矩形而不仅仅是正方形?在该示例中,如果我移动一侧,则相邻侧移动,使其保持方形选择.
谢谢.
Pau*_*eno 12
我发现可以使用内置的Android裁剪处理程序裁剪矩形.(com.android.camera.action.CROP).要裁剪矩形,您需要删除我之前传递的示例的以下参数:
intent.putExtra("outputX", 200); //Set this to define the max size of the output bitmap
intent.putExtra("outputY", 200); //Set this to define the max size of the output bitmap
intent.putExtra("aspectX", 1); //Set this to define the X aspect ratio of the shape
intent.putExtra("aspectY", 1); //Set this to define the Y aspect ratio of the shape
Run Code Online (Sandbox Code Playgroud)
设置aspectX和aspectY将强制android在移动其中一个时移动形状的两侧.注释这些线条,你就可以随意移动形状了.
| 归档时间: |
|
| 查看次数: |
8528 次 |
| 最近记录: |