+ 2
Get backgroundcolor of elemt in Android studio java
I know, how to set: elementID.setBackgroundColor(Color.BLUE) Now I want to check: if color is blue, then set White I thought: if(elementID.getBackgroundColor == Color.BLUE) but there is no such thing as "getBackgroundColor" So how to get the BG-Color of the element (EditText in my case)? Thank you in advance!
2 Respostas
+ 2
I do something like this,
int color=((ColorDrawable)element.getBackground()).getColor();
If(color==Color.BLUE){}
+ 1
Thank you!