1

I have seen questions that ask about changing the Android menu background color. I do not want to do this, I just want to determine if the menu is dark or light and show a different icon accordingly.

How can you tell if the Android menu background is dark or light?

Arash Milani
  • 6,149
  • 2
  • 41
  • 47
Kevin Westwood
  • 7,739
  • 8
  • 38
  • 52

1 Answers1

0

This question has been described before. And here are some answers: this and this (by wiseman)

Edit:

Didn't try by myself but you may do something with following code:

getTheme().obtainStyledAttributes(android.R.attr.windowBackground);

It returns TypedArray from which you can obtain the value of attribute somehow.

Community
  • 1
  • 1
teoREtik
  • 7,886
  • 15
  • 46
  • 65
  • those questions describe how to set the background color, but all I am trying to do is determine if the background color is light or dark. Is there a way to do this? – Kevin Westwood Jun 04 '12 at 16:55