How to provide textcolor textview in class file

I am creating a custom textview, I want to give black text for this text view. how can i set textcolor. my code

TextView textview = new TextView (this);

textview.setText ("Please follow this description");

setContentView (_textview);

when i use textview.setTextColor (Integer.parseInt ("# 000000"))

Thanks in advance

+3
source share
2 answers

Use Color.parseColor ():

textview.setTextColor(Color.parseColor("#000000"));

another option is to directly use the HEX value:

textview.setTextColor(0xff000000);
+4
source

I found a solution made using code

textview.setTextColor (Color.BLACK);

0

Source: https://habr.com/ru/post/1761675/


All Articles