I have a list and i write a custom adapter for this. And I want to set some text color for this (e.g. Orange color code #F06D2F). I am presenting the code snippet for my g
try like this , the following worked fine for me
textview.setTextColor(this.getResources().getColor(R.color.orange));
Yes, You can try this
textview.setTextColor(this.getResources().getColor(R.color.orange));
For Kotlin just use holder.text.setTextColor(Color.RED);
This is what worked for me.
Import first: import android.graphics.Color;
Then you can use: textview.setTextColor(Color.BLUE);
text.setTextColor(Color.parseColor("#FFFFFF"));
This worked for me, and it is simple. First, import "Color"
import android.graphics.Color;
Then all you have to do is this:
text.setTextColor(Color.RED);
Just discovered this today (9/20/13). You can go ahead and declare a variable like this:
private final int ORANGE = 0xFFFF3300;
Then all you have to do is:
text.setTextColor(ORANGE);
Note that the first two hex characters are for opacity ("FF" means opaque). Then, in the example above, the second "FF" is for red, then "33" is for green, and "00" is for blue. Should be possible to create a great many colors this way.
I am pretty new at this Android programming - this is my first post to this forum. Thanks to all of you for your contributions!