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

问题描述 投票:0回答:3

使用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() {
            ....
            }
        });
android imageview picasso
3个回答
3
投票

要使用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() {
            ....
            }
        });

0
投票

试试这个,

您只需提供图像视图所需的角度,如下所示,

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

0
投票

这是正确的:Picasso.get().load(image.url).rotate(90F).into(view)

© www.soinside.com 2019 - 2024. All rights reserved.