I am using from Picasso
for show image in my app .I set a default image for Picasso
that it is vector
. Like bellow :
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="24"
android:viewportHeight="24"
android:width="24dp"
android:height="24dp">
<path
android:pathData="M0 0L24 0 24 24 0 24Z"
android:fillColor="#dcdcdc" />
<path
android:pathData="M15.9 15.9l-7.8 0c-0.5 0 -1 -0.4 -1 -1L7.1 9c0 -0.5 0.4 -1 1 -1L16 8c0.5 0 1 0.4 1 1l0 6c-0.1 0.5 -0.5 0.9 -1.1 0.9zm0 -6.9l-7.8 0 0 6 7.9 0 0 -6zm-3.9 3.5l1 -0.5 2 1.2 0 0.8 -6 0 0 -2 1 -1 2 1.5zm2.2 -1c-0.4 0 -0.7 -0.3 -0.7 -0.7 0 -0.4 0.3 -0.7 0.7 -0.7 0.4 0 0.7 0.3 0.7 0.7 0 0.4 -0.3 0.7 -0.7 0.7z"
android:fillColor="#ffffff" />
</vector>
And I use from it in Picasso
:
Picasso.with(itemView.getContext())
.load(productsModelList.getPictureUrl())
.placeholder(AppCompatDrawableManager.get().getDrawable(context, R.drawable.placeholder_pictures))
.fit()
.into(imgImageProduct);
Problem : When I use from default image( vector ) in Picasso
when I get image url
from server and load the Image it is Progressive(Obscure) but when I use from default image( jpg ) everything works fine .
But when I use from jpg everything works fine :
Picasso.with(itemView.getContext())
.load(productsModelList.getPictureUrl())
.placeholder(R.drawable.placeholder_picture)
.fit()
.into(imgImageProduct);
Resolved my problem. I changed size of vector
android:width="150dp"
and android:height="150dp"
:
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="24"
android:viewportHeight="24"
android:width="150dp"
android:height="150dp">
<path
android:pathData="M0 0L24 0 24 24 0 24Z"
android:fillColor="#dcdcdc" />
<path
android:pathData="M15.9 15.9l-7.8 0c-0.5 0 -1 -0.4 -1 -1L7.1 9c0 -0.5 0.4 -1 1 -1L16 8c0.5 0 1 0.4 1 1l0 6c-0.1 0.5 -0.5 0.9 -1.1 0.9zm0 -6.9l-7.8 0 0 6 7.9 0 0 -6zm-3.9 3.5l1 -0.5 2 1.2 0 0.8 -6 0 0 -2 1 -1 2 1.5zm2.2 -1c-0.4 0 -0.7 -0.3 -0.7 -0.7 0 -0.4 0.3 -0.7 0.7 -0.7 0.4 0 0.7 0.3 0.7 0.7 0 0.4 -0.3 0.7 -0.7 0.7z"
android:fillColor="#ffffff" />
</vector>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.