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

如何在android中通过Url设置布局的背景图像?,android,android-layout,android-imageview,Android,Android Layout,Android Imageview,在我的应用程序中,通过JSON从web url设置布局的背景。但在图像视图中,我是这样设置的 try { ImageView i = (ImageView)findViewById(R.id.animation); Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://alpharithm.in/manager/test/img/fil

在我的应用程序中,通过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();
                }

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

您可以从该表格中获取参考


希望这将对您有所帮助。

您可以从这里获得参考资料

希望这对你有帮助