Android ImageView Fixing Image Size

后端 未结 4 1262
梦如初夏
梦如初夏 2021-01-30 12:44

I have an Android Application, where I have an ImageView, I need to keep the size constant, there can be various images that I need to put into this ImageView

4条回答
  •  梦毁少年i
    2021-01-30 13:23

    In your case you need to

    1. Fix the ImageView's size. You need to use dp unit so that it will look the same in all devices.
    2. Set android:scaleType to fitXY

    Below is an example:

    
    

    For more information regarding ImageView scaleType please refer to the developer website.

提交回复
热议问题