我上传到服务器后,在模式景观上拍照bt相机......这是景观.
我使用Picasso将图像加载到Imageview.我希望在ImageView上显示原始图像...请为我建议... tks这么多!
public static void makeImageRequest(Context context, ImageView imageView, final String imageUrl, ProgressBar progressBar) {
final int defaultImageResId = R.drawable.ic_member;
Picasso.with(context)
.load(imageUrl)
.error(defaultImageResId)
.resize(80, 80)
.into(imageView);
}
Run Code Online (Sandbox Code Playgroud)
ImageView的:
<ImageView
android:layout_centerInParent="true"
android:padding="@dimen/_8sdp"
android:id="@+id/img_photo"
android:layout_width="@dimen/_80sdp"
android:layout_height="@dimen/_80sdp"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
Run Code Online (Sandbox Code Playgroud)
网址:
https://arubaitobsv.s3-ap-northeast-1.amazonaws.com/images/1487816629838-20170223_092312_HDR.jpg
Run Code Online (Sandbox Code Playgroud)
raf*_*007 19
问题在这里发布
毕加索自动将来自网络的图像旋转90度,该图像具有以下EXIF数据:
Resolution : 3264 x 2448
Orientation : rotate 90
Run Code Online (Sandbox Code Playgroud)
用毕加索尝试这个代码:
Picasso.with(MainActivity.this)
.load(imageURL) // web image url
.fit().centerInside()
.transform(transformation)
.rotate(90) //if you want to rotate by 90 degrees
.error(R.drawable.ic_launcher)
.placeholder(R.drawable.ic_launcher)
.into(imageview)
});
Run Code Online (Sandbox Code Playgroud)
你也可以使用Glide:
dependencies {
// Your app's other dependencies
compile 'com.github.bumptech.glide:glide.3.7.0'
}
Run Code Online (Sandbox Code Playgroud)
使用以下图片:
Glide.with(this).load("image_url").into(imageView);
Run Code Online (Sandbox Code Playgroud)
小智 8
public class ImageRotationDetectionHelper {
public static int getCameraPhotoOrientation(String imageFilePath) {
int rotate = 0;
try {
ExifInterface exif;
exif = new ExifInterface(imageFilePath);
String exifOrientation = exif
.getAttribute(ExifInterface.TAG_ORIENTATION);
Log.d("exifOrientation", exifOrientation);
int orientation = exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
Log.d(ImageRotationDetectionHelper.class.getSimpleName(), "orientation :" + orientation);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_270:
rotate = 270;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotate = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_90:
rotate = 90;
break;
}
} catch (IOException e) {
e.printStackTrace();
}
return rotate;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12372 次 |
| 最近记录: |