【问题标题】:ImageView scaleTypeImageView scaleType
【发布时间】:2015-11-12 23:19:48
【问题描述】:

这是我在应用程序中的ImageView (1)

当我更改容器的大小(例如LinearLayout)时,我的ImageView 更改了图像大小,但视图边框保持不变(2)。

如何设置ImageView 的大小和边框的缩放比例? (3)

我的ImageView xml 代码:

 <ImageView
            android:id="@+id/image"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:src="@drawable/cover" />

附:这是我的应用程序中的问题-

【问题讨论】:

    标签: android android-imageview scale


    【解决方案1】:

    我从这里找到 - stackoverflow.com/a/10124018/3871859

    我的ImageViewxml:

    <ImageView
                android:id="@+id/image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:src="@drawable/cover" />
    

    我只是添加了这一行:

    android:adjustViewBounds="true"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-20
      • 1970-01-01
      • 2015-06-29
      相关资源
      最近更新 更多