2

I want to make something like

wow its cool app

in android. so that users can see a bold text in both TextView and EditText like WhatsApp. I don't know what to do. I searched and found something in which we can use HTML tags but some of the users don't know how to use that. Is there a way so that it is easy for users to make some part of text bold and remaining will normal.

Here is the image which will clear more

enter image description here

in this image, users can bold some part of text by enclosing that in *'s.

enter image description here

W4R10CK
  • 5,300
  • 2
  • 15
  • 28
Harish Kamboj
  • 759
  • 10
  • 30

2 Answers2

0

For you to make text bold? Place it in a StyleSpan with a bold style to it. For the user to make it bold? You'll have to provide some UI for them to do that, that isn't built in.

Gabe Sechan
  • 77,740
  • 9
  • 79
  • 113
0

You have to use HTML code and set to textview or edittextview as following..

TextView textView = (TextView) findViewById(R.id.textView);
String first = "Hello what's up ";
String next = "<B>some bold text </B>";
textView.setText(Html.fromHtml(first + next));

if you want to add bold text after '' character then find that character from textview or edittextview and apply tag after '' this character and set text into textview and edittextview

Subhash Khimani
  • 429
  • 7
  • 22