2

How to set color to the card object?

There is some information about which are the support html tags, however i don´t know how to use it.

 Card m_InstructionCard new Card(this);
 String texto = getString(R.string.instruction_card_text);
 m_InstructionCard.setText(Html.fromHtml(texto));       
 m_InstructionCard.setTimestamp(R.string.instruction_card_info);
 m_InstructionCard.addImage(R.drawable.second_capture);

The function setText don´t support spanned. Should I use style? There is some example of how do it? As i can´t use card with resource xml, i don´t know how to do it.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
Oximer
  • 548
  • 5
  • 19

1 Answers1

0

The Card.setText method currently only supports unstyled Strings. Please file an enhancement request on our issue tracker if you would like to see other features.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
  • So nowadays its impossible to set color on text using the GDK? Nothings using style or other options? – Oximer Dec 18 '13 at 14:58
  • If you are using the `Card` class to generate a view hierarchy (by calling `toView`), you could then drill down into that view hierarchy and find the `TextView` and pass a `Spanned` directly into it. That's fragile, though, because those `Card` layouts could change in the future, and this would also not work for static cards because you do not have access to the view hierarchy in that case when you publish one to the timeline. – Tony Allevato Dec 18 '13 at 15:01