毕加索以横向模式显示图像

Picasso showing image in a Landscape mode

使用 Picasso 库从服务器下载图像并放置在 ImageView 中,但每次它仅以横向模式显示图像,甚至图像最初以纵向模式显示。

我有一些图像处于横向模式,一些图像处于纵向模式,但在下载并显示到 ImageView 时,我只能进入横向模式!

毕加索的用法:

        Picasso.with(MainActivity.this)
        .load(imageURL) // web image url
        .fit().centerInside()
        .transform(transformation)
        .error(R.drawable.ic_launcher)
        .placeholder(R.drawable.ic_launcher)
        .into(viewHolder.imageView , new Callback() {
            ....
            }
        });

试试这个,

您可以简单地提供图像视图所需的角度,如下所示,

 <ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:rotation="90" />

使用Picasso旋转图片,只需在picasso的load()方法中设置旋转角度即可,如下

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(viewHolder.imageView , new Callback() {
            ....
            }
        });