Prunus
Prunus

Reputation: 11

setTextColor not working with Galaxy + Android 5.01

the code

    String heartSymbol = "\u2665";
    TextView titel = (TextView)findViewById(R.id.titel);
    titel.setText(heartSymbol);
    titel.setTextColor(Color.RED);

works fine on every device besides on Galaxy with Android 5.01 or 5.02 Tested on Galaxy S4 and Samsung Galaxy Note Pro 12.2 (model SM-P900) The text stays black in that case.

I have tried

setTextColor(ContextCompat.getColor(this, R.color.heart_color));

But no succes.

Does anyone knows a solution for this?

Upvotes: 0

Views: 114

Answers (1)

Prunus
Prunus

Reputation: 11

I have found out that some Samsungdevices with certain systemsoftware doesn't show all unicode symbols in color. In my case the hearts are presented in black. And it was not possible to set the textColor to red. So my solution is to use a background image in the textview.

In code:

TextView titel = (TextView)findViewById(R.id.titel);
titel.setText("");
titel.setBackground(ContextCompat.getDrawable(this, R.drawable.hearts));

Upvotes: 1

Related Questions