如何设置背景图像的布局通过Url在android



在我的应用程序中通过JSON从web url设置布局的背景。但在图像视图中,我这样设置

try {
                  ImageView i = (ImageView)findViewById(R.id.animation);
                  Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://alpharithm.in/manager/test/img/files/products/mushroom-soup.jpg").getContent());
                  i.setImageBitmap(bitmap); 
                } catch (MalformedURLException e) {
                  e.printStackTrace();
                } catch (IOException e) {
                  e.printStackTrace();
                }

不能设置为背景。如何设置布局的背景?

您可以从中获得参考

设置线性布局背景

最新更新