I'm using the follow code, to create a non-scaled, centred image as a background, in a relative layout:-
RelativeLayout explosionlayout = (RelativeLayout) findViewById (R.id.explosionlayout);
explosionlayout.setBackgroundColor(R.color.white);
Bitmap myBitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.bomb);
BitmapDrawable test1 = new BitmapDrawable(myBitmap);
test1.setGravity(Gravity.CENTER);
The only problem I have, is that the background of the relativelayout is grey, regardless of what I set it to, either via XML or in code.
Any ideas would be appreciated, thanks.