Java – sets the background image of the surfaceview

Is there any way to set the background image of surfaceview? Do I have to do it in XML, or can I do everything in Java - there are some things in my constructor that look like this:

Drawable sky = (getResources().getDrawable(R.drawable.sky));
    this.setBackgroundDrawable(sky);

But it still doesn't show anything

Solution

You cannot set the background paintable on the surfaceview You must paint the background on the surface yourself

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>