Set the Background Image of a SurfaceView
Is there a way to set the background image of a SurfaceView? Does it have to be done in xml or can I do it all in Java - I've got something that looks like this in my constructor: Drawable sky = (getResources().getDrawable(R.drawable.sky)); this.setBackgroundDrawable(sky); But it still doesn't show anything. You cannot set a background drawable on a SurfaceView. You'll have to draw the background onto the surface yourself. Try this public void surfaceCreated(SurfaceHolder arg0) { Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.background); float scale = (float