如何将我作为 JSON 获得的图像设置为 imageview?下面是我的代码..
try {
JSONObject responseObject = json.getJSONObject("responseData");
JSONArray resultArray = responseObject.getJSONArray("results");
private ArrayList<Object> listImages;
listImages = getImageList(resultArray);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
现在,我想将图像设置为 imageview,如下所示...
private int[] GalImages = new int[] { R.drawable.h, R.drawable.i};
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = new ImageView(context);
int padding = context.getResources().getDimensionPixelSize(R.dimen.padding_medium);
imageView.setPadding(padding, padding, padding, padding);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setImageResource(GalImages[position]);
((ViewPager) container).addView(imageView, 0);
return imageView;
}
在这里,我默认设置了可绘制文件夹中的图像,但是我必须将我得到的图像设置为 json,我该怎么做?