-4

I need to design two textview like this:

Desired design

I am trying to do the same by two TextViews, but as the next TextView is at the end of the first one, it appears beside the first one. I need only the first line to be beside the first one and the rest below that.

How can I accomplish this?

Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187

2 Answers2

1

Use html string with different color as below.

String styledText = "This is <font color='your color code'>simple</font>.This is <font color='your color code'>simple</font>";

textView.setText(Html.fromHtml(styledText));
Keyur Thumar
  • 608
  • 7
  • 19
0

You can use one TextView instead two, and then use 'SpannableString' to customized front's style. like this:

new SpannableString("string").setSpan(new ForegroundColorSpan(Color.MAGENTA), 12, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
Chetan Joshi
  • 5,582
  • 4
  • 30
  • 43
weird
  • 1
  • 2