Skip to content Skip to sidebar Skip to footer

How To Give Textcolor To Textview In Class File

I am creating the custom textview i want to give black textcolor to this textview. how can i set textcolor. my code is TextView textview = new TextView(this); textview.setText('Pl

Solution 1:

Use Color.parseColor():

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

another option is to use HEX integer directly:

textview.setTextColor(0xff000000);

Solution 2:

I found the solution it is done by using the code

textview.setTextColor(Color.BLACK);

Post a Comment for "How To Give Textcolor To Textview In Class File"