Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Glideandroid-dons';不显示所有图像_Android_Android Imageview_Android Glide - Fatal编程技术网

Glideandroid-dons';不显示所有图像

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

我必须在我的应用程序中拍照。拍摄之后,我必须在ImageView中显示它,所以我决定使用Glide作为库来处理它

我将代码设置为:

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标记中。嗯。。。好了,现在我明白为什么会这样了。谢谢