Je souhaite afficher l'image (URL) dans mon image comme largeur maximale et hauteur variable en fonction de la largeur, lorsque j'utilise ce code:Android Picasso "fit(). CenterCrop()" ne charge pas l'image
imageView = (ImageView) convertView.findViewById(R.id.imageView);
Picasso.with(context).load(product.getImage()).into(imageView);
Je peux afficher mon image dans l'imageview. J'ai également essayé resize(). CenterCrop() méthodes et cela a fonctionné avec succès.
Mais cependant, quand j'utilise
Picasso.with (contexte) .load (product.getImage()) s'adapter() centerCrop() dans (imageView)...
ou
Picasso.with (contexte) .load (product.getImage()) ajuster() centerInside() en (en imageView)...;
mon imageview n'affiche rien. Je ne comprends pas pourquoi. Peut-être le problème ma conception de la liste et imageview. Voici mon list_content_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.80"
app:srcCompat="@mipmap/ic_launcher" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:layout_weight="0.2"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_weight="0.3"
android:layout_height="match_parent" />
<TextView
android:id="@+id/tv_stats"
android:layout_weight="0.7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
J'ai essayé mis wrap_content et match_parent à la fois de la largeur et de la hauteur ImageView et il n'a pas fonctionné, aussi. Où suis-je porté disparu? Merci d'avance.
Utilisation connexion pour voir la trace de picasso en utilisant 'Picasso.with (contexte) .setLoggingEnabled (true);' Vous pouvez mettre cette ligne dans votre 'Application' pour vous connecter toute l'application ou juste dans votre activité/fragment. –