次のコードを使用して、スケーリングされていない中央の画像を背景として相対的なレイアウトで作成しています:-
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);
私が持っている唯一の問題は、相対レイアウトの背景が、XML またはコードで設定したものに関係なく灰色であることです。
任意のアイデアをいただければ幸いです。