How can i get the backround color of a textview using only API 9?
I basicly want to do this but only using API 9
int intID = (ColorDrawable) textView.getBackground().getColor();
How can i get the backround color of a textview using only API 9?
I basicly want to do this but only using API 9
int intID = (ColorDrawable) textView.getBackground().getColor();
Great answer! I just wanted to add that the private field
mState
has two color fields:mUseColor
mBaseColor
For getting the color the above code is great but if you want to set the color, you have to set it to the both fields due to problems in
StateListDrawable
instances:Hope this was helpful! :)
try this...