1、概述:
像imageview设置bitmap背景可以用“imageview.setImageBitmap(bitmapimage);”,但是其他的控件却没有这样的方法,(比如一些Linearlayout,还有其他的layout,是没有这个方法的),但是有需求,那用什么呢?如下:
linearLayout.setBackground( new BitmapDrawable(bitmap));
linearLayout.setBackground( new BitmapDrawable(getResources(),bitmap));
以上2个方法都可以,我是百度到了“https://ask.youkuaiyun.com/questions/322835” 里的问答,然后自己试了一下,完全阔以。
bitmap设置背景:
Bitmap bitmap_video = Bitmap.createBitmap(modelImage.getImgWidth(), modelImage.getImgHeight(),
Bitmap.Config.ARGB_8888);
bitmap_video.eraseColor(Color.parseColor("#FE4340"));//填充颜色