如何通过URL中的Andr​​oid设置布局的背景图像? [英] how set a background image of the layout via Url in android?

查看:141
本文介绍了如何通过URL中的Andr​​oid设置布局的背景图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序通过JSON设置从网页的URL布局背景。但在图像视图我设置这样的

In my application to set background of layout from web url through the JSON. But in image view I am setting like this

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();
                }

未设置作为背景。我怎么可以设置布局的背景是什么?

Not to set as a background. How can I set a background for the layout?

推荐答案

您可以参考表格这一点。

You can get reference form this.

组线性布局背景

希望这将是有益的给你。

Hope this will be helpfull to you.

这篇关于如何通过URL中的Andr​​oid设置布局的背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆