【发布时间】:2013-11-16 02:20:13
【问题描述】:
基本上我想做的是,使用图片的url(下载与否无所谓)来设置relativelayout的背景
我已经用谷歌搜索了几个小时并尝试了很多建议,但我总是以错误和应用程序崩溃告终...
if((!modelsArrayList.get(position).isGroupHeader())&& (modelsArrayList.get(position).isProfBox())) {
rowView = inflater.inflate(R.layout.prof_header, parent, false);
TextView titleView = (TextView) rowView.findViewById(R.id.header);
titleView.setText(modelsArrayList.get(position).getTitle());
RelativeLayout rLayout=(RelativeLayout)rowView.findViewById(R.id.ProfHead);
rLayout.setBackgroundResource("HTTP://URL.HERE");
我尝试过其他类似的方法 (http://looksok.wordpress.com/2013/07/06/android-tutorial-download-image-from-the-internet-with-url/),但没有成功
【问题讨论】:
-
你需要先下载图片。发出http请求
标签: android setbackground