码迷,mamicode.com
首页 > 其他好文 > 详细

为ImageView设置背景图片(代码中)

时间:2015-08-19 11:14:19      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

只需三行代码

Resources resources = getBaseContext().getResources();   
Drawable imageDrawable = resources.getDrawable(R.drawable.background_image); //图片在drawable目录下
mImageView.setBackgroundDrawable(imageDrawable);

版权声明:本文为博主原创文章,未经博主允许不得转载。

为ImageView设置背景图片(代码中)

标签:

原文地址:http://blog.csdn.net/qq_16912257/article/details/47776851

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!