android - 图像不填充 ImageView Android 中的宽度

标签 android android-imageview

将照片设置到 ImageView 并没有像我预期的那样工作。它没有完全填满宽度。 enter image description here 这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/black"
    android:orientation="horizontal" >

    <com.android.volley.toolbox.NetworkImageView
        android:id="@+id/imageCell"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:layout_margin="5dp"
        android:src="@drawable/unnamed" />

</LinearLayout>

我尝试使用 android:layout_width="wrap_content" 仍然没有任何变化。

第一张图片显示不完整。第二个是人像模式,没问题。 谢谢。

最佳答案

尝试设置

android:scaleType="fitXY"

到你的imageView

关于android - 图像不填充 ImageView Android 中的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21505768/

相关文章:

android - 我可以隐藏布局上的图像按钮(尺寸和背景)直到调用设置可见吗?

android - 我可以让 IntelliJ 通过设备而不是模拟器调试我的 android 应用程序吗?

安卓 ImageView-16 :9

android - 如何在android中实用地设置图像的layout_width

android - 创建上面有 textview 的 imageview 图像

android - 如何将 Canvas 上的点保持在屏幕上的固定点,即使 Canvas 缩放时也是如此? - 安卓

java - 如何在Android中从URL加载不带文件扩展名的图像到ImageView

安卓;带有自定义对话框的进度条

android - 在 Android API 30 或更高版本中无法正确获取应用程序名称

java - 为什么我的内容 uri 出现错误?