Adham
Adham

Reputation: 64904

How to create a Gird of images in android (like the attached screenshot)

I want to to create a grid of images like this :

enter image description here

What I am asking about is how to make the images appear suitably, without being stretched or having a blink spaces. I just what the images (in different sizes) to fit the available spaces. ..

how ? and thanks in advance

Upvotes: 0

Views: 109

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 200120

Sounds like you are looking for ImageView.ScaleType.CENTER_CROP. CENTER_CROP ensures that every image will fit both the height and width of the allocated space with no gap. You can add to your xml via:

<ImageView
    ...
    android:scaleType="centerCrop" />

Upvotes: 1

Related Questions