Android ImageView Fixing Image Size

后端 未结 4 1261
梦如初夏
梦如初夏 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:37

    You can also try this, suppose if you want to make a back image button and you have "500x500 png" and want it to fit in small button size.

    Use dp to fix ImageView's size.

    add this line of code to your Imageview.

    android:scaleType="fitXY"

    EXAMPLE:

    
    

提交回复
热议问题