使用ImageGallery显示从SD卡中的图片? [英] Using ImageGallery to display images from the SD card?
本文介绍了使用ImageGallery显示从SD卡中的图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何使用ImageGallery显示图像我已保存在SD卡上的特定位置?
How would I use ImageGallery to display images I have saved in a particular location on the sd card?
推荐答案
几种方法可以做到这一点,例如:
several ways to to do this, for example
//Using an array with the names of your stored pics (myPics)
public View getView(final int position, View convertView, ViewGroup parent) {
ImageView myImageView = new ImageView(mContext);
if (convertView != null)
myImageView = (ImageView) convertView;
else
myImageView = new ImageView(mContext);
Bitmap bitmapImage = BitmapFactory.decodeFile("/sdcard/myTempFolfer/" + myPics(position));
BitmapDrawable drawableImage = new BitmapDrawable(bitmapImage );
myImageView.setImageDrawable(drawableImage );
return myImageView;
}
这篇关于使用ImageGallery显示从SD卡中的图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文