【发布时间】:2023-03-27 18:10:01
【问题描述】:
如何使用 ImageGallery 显示我保存在 sd 卡特定位置的图像?
【问题讨论】:
标签: android
如何使用 ImageGallery 显示我保存在 sd 卡特定位置的图像?
【问题讨论】:
标签: android
有几种方法可以做到这一点,例如
//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;
}
【讨论】: