-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
  • 36,649
  • 15
  • 132
  • 186

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
  • 589
  • 6
  • 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,442
  • 4
  • 27
  • 38
weird
  • 1
  • 2