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.