Crop image to square - Android

后端 未结 4 1915
盖世英雄少女心
盖世英雄少女心 2021-02-05 08:29

How can I cut rectangular image (600 x 300) from left and right to fit in square ImageView ? I don\'t want to resize image, I just want to crop it, to be 300 x 300.

4条回答
  •  北海茫月
    2021-02-05 08:58

    set fixed image view height, width, and set two properties to image view

    android:adjustViewBounds="true" 
    android:scaleType="centerCrop"
    

    done

提交回复
热议问题