يعمل رمز تنزيل الصور لجميع تنسيق الصورة، مشكلات مع تنسيق تنسيق PNG
-
15-11-2019 - |
سؤال
أنا أستخدم الرمز أدناه لتنزيل الصور وإظهارها من الخادم إلى My ImageView giveacodicetagpre.
ملف Works هذا البرنامج لجميع تنسيق الصور، ولكن عندما يتعلق الأمر ب PNG، لن يسمح للصورة شفافة بعد التنزيل والعرض على ImageView.
أي فكرة؟
المحلول
I dont know it will be a solution for you or not
But you can use a Drawable
instead of Bitmap
Here is the code
void downloadFile(String fileUrl) {
try{
InputStream is = (InputStream) new URL(fileUrl).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
imgView.setImageDrawable(d);
} catch (IOException e) {
e.printStackTrace();
}
}
This will show a png
correctly
لا تنتمي إلى StackOverflow