'responsive image using picasso android

i started using Picasso instead of using drawable resources that would fill my app with KB, and MB of images, but i got a problem, i just can't find the proper way to make my images responsive in all different screens like was in previously code.

Image to understand my layout (i'm refering to the first image the big one)

enter image description here

xml code

<ImageView
            android:id="@+id/Chaves_Inicial"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            android:src="@drawable/inicial_chaves"
            app:layout_constraintBottom_toTopOf="@+id/gd_imagem_baixo"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/gd_inicial"
            app:layout_constraintVertical_bias="0.0" />

java

img_montalegre = findViewById(R.id.img_montalegre);
    String imagemmontalegre = "https://www.mybesthotel.eu/pic/_01_5b968f125d8de.jpg";
    Picasso.with(this).load(imagemmontalegre).into(img_montalegre);

i already tried risize.

I just want that my image stays like the image i put here in all different screens.



Solution 1:[1]

i change for this and looks almost good, in tablet gets the image a little weird very stretched (maybe i make another xml for tablet)

xml

<ImageView
            android:id="@+id/img_montalegre"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:adjustViewBounds="true"
            android:scaleType="fitXY"
            app:layout_constraintBottom_toTopOf="@+id/gd_imagem_baixo"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/gd_inicial"
            app:layout_constraintVertical_bias="0.0" />~

java

img_montalegre = findViewById(R.id.img_montalegre);
    String imagemmontalegre = "https://www.mybesthotel.eu/pic/_01_5b968f125d8de.jpg";
    Picasso.with(this).load(imagemmontalegre).into(img_montalegre);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lestat2022