2010-11-22 68 views
1

我希望能够将xml文件中图像按钮的背景设置为用户在手机上拍摄的图片。如何将图像按钮的背景设置为用户拍摄的图片?

我把图片设置为cameraBitmap。

cameraBitmap = (Bitmap) intent.getExtras().get("data"); 

我想将该图片传递给imagebutton的bakground。问题是,方法:setBackgroundDrawable()只能通过绘制。我该如何去改变该位图为可绘制的图片并将其作为背景?

我目前有:

private ImageButton theImageButton; 


theImageButton.setBackgroundDrawable(cameraBitmap); 

回答

6

如果您正在使用的ImageButton为什么你不能用这个

theImageButton.setImageBitmap(cameraBitmap) 
相关问题