Android 在ImageView中加载毕加索的图像在GridLayout中溢出?
通过编程设置Android 在ImageView中加载毕加索的图像在GridLayout中溢出?,android,imageview,android-gridlayout,Android,Imageview,Android Gridlayout,通过编程设置GridLayout中ImageView的背景色,我可以使UI看起来像这样。 我正在使用毕加索从这些网格中的服务器加载图像。图像正在拉伸以超出其定义的colspan和rowspan。为什么我会得到这个? 网格布局xml <android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.an
GridLayout
中ImageView
的背景色,我可以使UI看起来像这样。
我正在使用毕加索从这些网格中的服务器加载图像。图像正在拉伸以超出其定义的colspan和rowspan。为什么我会得到这个?
网格布局xml
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tableGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth"
android:verticalSpacing="0dp"
app:alignmentMode="alignBounds"
app:columnOrderPreserved="true"
app:rowOrderPreserved="true"
app:useDefaultMargins="false"/>`
指导我,使我可以将图像正确地放入这些网格。我解决了我的问题。
问题出在使用毕加索加载图像的线路上。库正在调整我的图像大小。
我将图像加载行更改为
Picasso.with(this).load(gridList.get(i).getProductImage()).fit().noFade().into(oImageView);
Picasso.with(this).load(gridList.get(i).getProductImage()).fit().noFade().into(oImageView);