【问题标题】:Adjustviewbounds works in the preview but not in the emulatorAdjustviewbounds 在预览中有效,但在模拟器中无效
【发布时间】:2017-11-03 01:33:34
【问题描述】:

它在预览中工作得非常好,但在模拟器中,图像在 api 17 的左侧和右侧得到空白。但是当我尝试在不同的模拟器中使用 api 26 时,它工作得非常好。有没有其他方法可以解决这样的问题。

ImageView 的代码

    <ImageView
            android:layout_width="fill_parent"
            android:adjustViewBounds="true"
            android:layout_height="wrap_content"
            android:src="@drawable/snebakgrund"
            android:id="@+id/historikHeader"
            android:scaleType="fitCenter"

https://gyazo.com/056920e5f1772e34d09097186ffc0218(预览) https://gyazo.com/e6f774678352ca85265e44e1048c78b9 (模拟器 api.17)

【问题讨论】:

    标签: java xml android-studio


    【解决方案1】:

    'adjustViewBounds' 属性要求图像具有一定大小或更大才能工作(高度为 204 像素或更高 ~ xxhdpi)。

    【讨论】:

      猜你喜欢
      • 2021-05-25
      • 2017-12-21
      • 1970-01-01
      • 2015-09-26
      • 2021-03-25
      • 1970-01-01
      • 2015-12-10
      • 1970-01-01
      • 2019-03-20
      相关资源
      最近更新 更多