作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
gridcell = (Button) row.findViewById(R.id.calendar_day_gridcell);
gridcell.setText("Day 1");
URL url = new URL("http://172.16.4.29:81/pht/2013/9/18/3027_2013_9_18_12_14_56_b.JPG");
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
如何将 位图
bmp 图像设置为按钮网格单元背景图像?
最佳答案
你可以使用下面的代码来做到这一点..
BitmapDrawable bdrawable = new BitmapDrawable(context.getResources(),bitmap);
然后用下面的函数设置位图
button.setBackground(bdrawable);
关于android - 如何将位图图像设置为按钮背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18952764/
我是一名优秀的程序员,十分优秀!