-1

How to get the color of view. If there isn't any way please write the code for it.

CatCoder
  • 248
  • 2
  • 10

1 Answers1

0

If you use view.setBackgroundColor() method to set the color of view, view will auto create a ColorDrawable instance to set to the view, you just need to call int color = ((ColorDrawable)view.getBackground()).getColor() to retrieve the color. If you want to get the color value in hexadecimal format, just invoke 'Integer.toHexString(color)'

hope this can help you

Tang Ke
  • 1,508
  • 12
  • 12