Hacer un texto de cadena Negrita en Java Android

Quiero hacer Hábito Número : audaz, he intentado la etiqueta HTML, pero no funcionó. Hice algunas investigaciones, pero no pude encontrar ninguna. Espero que alguien pueda ayudarme. ¡Gracias!

String habitnumber = "Habit Number: " + String.valueOf(habitcounter); String Title = habit.getTitle(); String description = habit.getDescription(); //Set text for the row tv.setText(habitnumber+ "\n" + Title + " \n" + description + "\n --------------------"); 

 I tried the HTML tag but it didn't work 

Creo que no Html.fromHtml su cadena de Html.fromHtml

solución:

Puedes hacerlo con HTML usando la etiqueta html para negrita: <b>

  String habitnumber = "<b>" + "Habit Number: " + "</b> " + String.valueOf(habitcounter); tv.setText(Html.fromHtml(habitnumber )); 
 tv.setTypeface(null, Typeface.BOLD); 

Como Gabe mencionado, intente usar el uso Html.fromHtml o el uso spannable. Compruebe esto: Selección, resaltado o estilización de partes de texto

Usted podría básicamente utilizar etiquetas html en su recurso de cadena como:

 <resource> <string id="@+id/styled_welcome_message"><b>your text</b></string> </resources> 

Utilice esto en el archivo XML, dentro de la vista de texto

 android:textStyle="bold" 
FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.