android - 无法在android中的imageview中清除或设置空白图像

标签 android imageview

if(bigimageS.length()==0){              

     show_image.setImageBitmap(null);   

}else{                  

  show_image.setImageBitmap(decodeImage(bigimageS));                
}

****************
    public static Bitmap decodeImage(String arrayList_image) {

        BufferedInputStream bis;
        URL aURL;
        try{        

            aURL = new URL(arrayList_image);
            URLConnection conn = aURL.openConnection();
            conn.connect();
            InputStream is = conn.getInputStream();
            bis = new BufferedInputStream(is);
            Bitmap bm = BitmapFactory.decodeStream(bis);

            bis.close();            
            is.close();         
            return bm;          

        } catch (MalformedURLException e) {

            e.printStackTrace();

        } catch (IOException e) {

            e.printStackTrace();
        }
        return null;
    }

这是我的代码,我想清除 imageview。我的问题是我在 bigimages String 中获取图像。我在字符串 bigimages 中添加来自 w/s.in 的 imageurl。当我在一次图像设置后单击下一个 btn 时然后旧图像不清楚。所以请帮助我设置条件但不工作。请帮助。

我正在使用 decodeimage 来解码图像,如果字符串中没有 url,是否有任何方法可以清除。请帮助我,但还没有解决

最佳答案

从 photoshop 创建一个空白/透明的 png 图像,并将其用作图像背景。

关于android - 无法在android中的imageview中清除或设置空白图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12294474/

相关文章:

java - 如何在 Android 中运行 cUrl 调用?

java - 注册数据未发送到 mySQL 数据库

android - ImageView setMargins 不起作用

android - 哪个框架可用于在 Android 上绘制复杂的交互式 UI 层次结构? (就像 iOS 上的 CoreAnimation)

android imageview 需要额外的黑色空间

java - Android - 无法使用矩阵在坐标处绘制图像

android - 如何退出 Facebook SDK 事件记录?

java - Android 应用程序错误(Activity Main)

android - 几个 ImageView-s 的 Activity 运行缓慢

android - RelativeLayout 中的 TextView 与 ImageView 重叠