Glideandroid-dons';不显示所有图像
我必须在我的应用程序中拍照。拍摄之后,我必须在ImageView中显示它,所以我决定使用Glide作为库来处理它 我将代码设置为:Glideandroid-dons';不显示所有图像,android,android-imageview,android-glide,Android,Android Imageview,Android Glide,我必须在我的应用程序中拍照。拍摄之后,我必须在ImageView中显示它,所以我决定使用Glide作为库来处理它 我将代码设置为: Glide.with(this) .load(mLastPhoto) .fitCenter() .centerCrop() .into(iv_circ_image); xml文件如下所示: <ImageView
Glide.with(this)
.load(mLastPhoto)
.fitCenter()
.centerCrop()
.into(iv_circ_image);
xml文件如下所示:
<ImageView
android:id="@+id/circ_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/bTakePicture"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="12dp"
android:src="@drawable/ab_background_textured_" />
但拍摄完照片后,图像显示如下:
Glide.with(this)
.load(mLastPhoto)
.fitCenter()
.centerCrop()
.into(iv_circ_image);
如何设置滑动代码或XML以显示所有图像?将
android:adjustViewBounds=“true”
属性添加到ImageView中。如果希望ImageView调整其边界以保留其可绘制的纵横比(来自API文档),请将其设置为true
在xml中,您有
android:layout\u height=“wrap\u content”
和android:layout\u marginTop=“12dp”
然后在java中有.fitCenter().centerCrop()
所以基本上你有一个12dp的图像视图,Glide正在填充。我建议您设置图像视图的高度(即200dp),或者让按钮贴在屏幕底部,让图像视图填充它们之间的可用空间。尝试将android:adjustViewBounds=“true”添加到图像视图xml标记中。嗯。。。好了,现在我明白为什么会这样了。谢谢