Android:与Instagram一样,毕加索的图像大小到全宽度和高度



RecyclerView中,图像显示为全高和宽度,并且不伸展,这是可能的吗?

尝试此代码

Picasso.with(myContext).load(uri).resize(720, 720)
                    .centerCrop().into(aImageView);

我认为它将适合您的状况。

将其添加到您的ImageView

android:adjustViewBounds="true"
android:scaleType="centerCrop"
  <ImageView
    android:id="@+id/imageView"
    android:layout_width="fixed_width_for_each_cell"
    android:layout_height="fixed_height_for_each_cell"
    android:scaleType="fitXY"
    android:adjustViewBounds="true"/>

仅使用android:scaleType =" fitxy"

使用 android:scaleType="centerInside"

imageView.scaletype Center_inside均匀地比图像(维持图像的纵横比),以使图像的尺寸(宽度和高度)等于或小于视图的相应维度(负填充)。

<ImageView
    android:id="@+id/imageView"
    android:layout_width="fixed_width_for_each_cell"
    android:layout_height="fixed_height_for_each_cell"
    android:scaleType="centerInside"
   />

中心属性内部不更改图像纵横比。如果将高度和宽度提供给ImageView的高度和宽度,则根据位图Aspect Ratio进行调整大小的图像,因此应显示其完整图像。

最新更新