无法使用 picasso 库加载解析图像。 "imgUrl is cannot be resolved to a symbhol"
Unable to load Parse Image using picasso library. "imgUrl is cannot be resolved to a symbhol"
过去几天我一直在努力将图像加载到 google 地图的信息窗口中。我相信我没有从正确解析中引用 url。谁能帮助我或指导我如何将解析图像放入信息窗口?这是该代码的片段。 (注意)我可以使用资源将图像加载到信息窗口中,但不能从解析中加载图像。 (我相信问题是我没有引用正确的项目)提前致谢。
PS: 这行代码: imgUrl 无法解析为符号
@Override
public void onMapReady(final GoogleMap googleMap) {
googleMap.setMyLocationEnabled(true);
this.googleMap = googleMap;
googleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
// Use default InfoWindow frame
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
// Defines the contents of the InfoWindow
@Override
public View getInfoContents(Marker marker) {
//icon.setImageResource(R.mipmap.back_vision_fade);
ParseQuery<ParseObject> query = ParseQuery.getQuery("Places");
View v = getActivity().getLayoutInflater().inflate(R.layout.maps_infowindow, null);
v.setLayoutParams(new LinearLayout.LayoutParams((int) (mapFragment.getView().getMeasuredWidth() * .9), LinearLayout.LayoutParams.WRAP_CONTENT));
((TextView) v.findViewById(R.id.title)).setText(marker.getTitle());
((TextView) v.findViewById(R.id.desc)).setText(marker.getSnippet());
ImageView icon = (ImageView) v.findViewById(R.id.imageView5);
Item item = new Item();
try {
List<ParseObject> objects = query.find();
for(ParseObject obj : objects){
ParseGeoPoint point = obj.getParseGeoPoint("location");
if(obj.getParseFile("icon")!=null) {
item.setIcon(obj.getParseFile("icon").getUrl());
//item.downloadIcon(context);
item.setIcon(obj.getParseFile("icon").getUrl());
Picasso.with(getActivity()).load(imgUrl).into(icon, new MarkerCallback(marker));
}
}
} catch (ParseException e) {
}
return v;
}
}
);
试试这个:
Picasso.with(getActivity()).load(obj.getParseFile("icon").getUrl()).into(icon, new MarkerCallback(marker));
过去几天我一直在努力将图像加载到 google 地图的信息窗口中。我相信我没有从正确解析中引用 url。谁能帮助我或指导我如何将解析图像放入信息窗口?这是该代码的片段。 (注意)我可以使用资源将图像加载到信息窗口中,但不能从解析中加载图像。 (我相信问题是我没有引用正确的项目)提前致谢。
PS: 这行代码: imgUrl 无法解析为符号
@Override
public void onMapReady(final GoogleMap googleMap) {
googleMap.setMyLocationEnabled(true);
this.googleMap = googleMap;
googleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
// Use default InfoWindow frame
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
// Defines the contents of the InfoWindow
@Override
public View getInfoContents(Marker marker) {
//icon.setImageResource(R.mipmap.back_vision_fade);
ParseQuery<ParseObject> query = ParseQuery.getQuery("Places");
View v = getActivity().getLayoutInflater().inflate(R.layout.maps_infowindow, null);
v.setLayoutParams(new LinearLayout.LayoutParams((int) (mapFragment.getView().getMeasuredWidth() * .9), LinearLayout.LayoutParams.WRAP_CONTENT));
((TextView) v.findViewById(R.id.title)).setText(marker.getTitle());
((TextView) v.findViewById(R.id.desc)).setText(marker.getSnippet());
ImageView icon = (ImageView) v.findViewById(R.id.imageView5);
Item item = new Item();
try {
List<ParseObject> objects = query.find();
for(ParseObject obj : objects){
ParseGeoPoint point = obj.getParseGeoPoint("location");
if(obj.getParseFile("icon")!=null) {
item.setIcon(obj.getParseFile("icon").getUrl());
//item.downloadIcon(context);
item.setIcon(obj.getParseFile("icon").getUrl());
Picasso.with(getActivity()).load(imgUrl).into(icon, new MarkerCallback(marker));
}
}
} catch (ParseException e) {
}
return v;
}
}
);
试试这个:
Picasso.with(getActivity()).load(obj.getParseFile("icon").getUrl()).into(icon, new MarkerCallback(marker));