Android ImageView ScaleType and item height

后端 未结 4 1505
滥情空心
滥情空心 2020-12-09 09:54

Things looked quite simple first but in the end the result is not good. I have an image which has a width larger than screen\'s width. So I need to scale it down in my image

相关标签:
4条回答
  • 2020-12-09 10:12

    use android:scaleType="fitXY"

    0 讨论(0)
  • 2020-12-09 10:20

    Use the scaletype which seems best to you ( I guess you like what you see with fitCenter). The additional thing that you must do is

    android:adjustViewBounds="true"

    in your ImageView.

    or you could go with FitXY but sometimes the result is not exactly what you want.

    0 讨论(0)
  • 2020-12-09 10:21

    Could you use FitXY? This would work if you knew the size of the area you were putting the image into. CentreInside may also work, I've used this to scale down images, but I think it depends if you've control of the size of the bounding layout element.

    0 讨论(0)
  • 2020-12-09 10:26

    You either need to set android:height = "wrap_content" on your outer container, or set static height of TextBox and give ImageView android:weight = "1" so that the ImageView takes remaining space in container.

    0 讨论(0)
提交回复
热议问题