Sap*_*app 1 android background image imagebutton drawable
我希望能够将xml文件中图像按钮的背景设置为用户在手机上拍摄的图片.
我将图片设置为cameraBitmap.
cameraBitmap = (Bitmap) intent.getExtras().get("data");
Run Code Online (Sandbox Code Playgroud)
我想把那张照片传递给imagebutton的bakground.问题是,方法: setBackgroundDrawable()只能传入drawable.如何将Bitmap更改为可绘制图片并将其作为背景?
我目前有:
private ImageButton theImageButton;
theImageButton.setBackgroundDrawable(cameraBitmap);
Run Code Online (Sandbox Code Playgroud)
如果您使用的是ImageButton,为什么不能使用它
theImageButton.setImageBitmap(cameraBitmap)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2533 次 |
| 最近记录: |