Home » Android » android – How to get the background drawable of an Activity's window?

android – How to get the background drawable of an Activity's window?

Posted by: admin June 15, 2020 Leave a comment

Questions:

From an Activity, I can set the background drawable like this:

getWindow().setBackgroundDrawable(drawable)

But I can’t find a method that retrieves the background drawable.

Is there one? If not, why not?

How to&Answers:

You can use getWindow().getDecorView().getBackground(); to retrieve the background drawable.