【问题标题】:Using ImageGallery to display images from the SD card?使用 ImageGallery 显示 SD 卡中的图像?
【发布时间】:2023-03-27 18:10:01
【问题描述】:

如何使用 ImageGallery 显示我保存在 sd 卡特定位置的图像?

【问题讨论】:

    标签: android


    【解决方案1】:
    【解决方案2】:

    有几种方法可以做到这一点,例如

        //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;
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-07
      • 2011-06-20
      • 2011-05-27
      • 1970-01-01
      • 2015-10-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多