android - Picasso.with() 没有在 android 中检索图像
问题描述
foodImage=(ImageView)getView().findViewById(R.id.imageView2);
String url1="https://d9hyo6bif16lx.cloudfront.net/live/img/production/detail/menu/lunch-dinner_soups-salads_crispy-chicken-salad.jpg";
Picasso.with(getActivity().getApplicationContext()).load(url1).fit().into(foodImage);
我无法检索它给我空白的图像。感谢您的建议。
解决方案
将毕加索依赖更新为
implementation 'com.squareup.picasso:picasso:2.71828'
并将代码修改为 -
Picasso.get().load(url1).resize(100,100).centerCrop().into(foodImage);
推荐阅读
- arrays - 每天查找数组 React
- string - 如何在 Scala 中将棋子与字符串分开?
- c# - 我用 DI 注入的服务有很多方法。有没有办法让这些容易找到?
- java - 如何在 Spark SQL Java 中将 CSV 类型字符串转换为数据框?
- spring - 无法创建简单的spring Boot Gateway api
- angular - 找出 Angular 项目中使用的更改事件的 Typescript 类型
- javascript - 如何用 Jest Javascript React Native 模拟“替换”功能?
- php - 如何使用 PHP 或 JavaScript 获取特定条件的当前 URL?
- delphi - Delphi 无效的类类型转换
- java - 哪种数据类型可用于在 Hibernate/jpa 中创建主键变量?