裁剪缩放的图像“Android”;
我无法裁剪缩放的图像我正在使用下面的代码来缩放图像。有人可以帮我吗?
这是代码。
public void selectRandomImage()
{
Cursor c = getContentResolver().query( Images.Media.EXTERNAL_CONTENT_URI, null, null,
null, null );
if ( c != null ) {
int count = c.getCount();
int position = (int)( Math.random() * count );
if ( c.moveToPosition( position ) ) {
long id = c.getLong( c.getColumnIndex( Images.Media._ID ) );
int orientation = c.getInt( c.getColumnIndex( Images.Media.ORIENTATION ) );
Uri imageUri = Uri.parse( Images.Media.EXTERNAL_CONTENT_URI + "/" + id );
Bitmap bitmap;
try {
bitmap = ImageLoader.loadFromUri( this, imageUri.toString(), 1024, 1024 );
mImageView.setImageBitmapReset( bitmap, orientation, true );
}
catch ( IOException e ) {
Toast.makeText( this, e.toString(), Toast.LENGTH_LONG ).show();
}
}
c.close();
c = null;
return;
}
I am unable to crop the image which is zoomed I am using the below code for zooming an image. Could anyone help me please?
This is the code.
public void selectRandomImage()
{
Cursor c = getContentResolver().query( Images.Media.EXTERNAL_CONTENT_URI, null, null,
null, null );
if ( c != null ) {
int count = c.getCount();
int position = (int)( Math.random() * count );
if ( c.moveToPosition( position ) ) {
long id = c.getLong( c.getColumnIndex( Images.Media._ID ) );
int orientation = c.getInt( c.getColumnIndex( Images.Media.ORIENTATION ) );
Uri imageUri = Uri.parse( Images.Media.EXTERNAL_CONTENT_URI + "/" + id );
Bitmap bitmap;
try {
bitmap = ImageLoader.loadFromUri( this, imageUri.toString(), 1024, 1024 );
mImageView.setImageBitmapReset( bitmap, orientation, true );
}
catch ( IOException e ) {
Toast.makeText( this, e.toString(), Toast.LENGTH_LONG ).show();
}
}
c.close();
c = null;
return;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 https://github.com/biokys/cropimage 可能对你有帮助。
一切顺利
try out https://github.com/biokys/cropimage may help u.
All The Best
试试这个::
try this ::