How to convert part of a string to italics?

后端 未结 3 1962
一个人的身影
一个人的身影 2021-01-22 11:44

I want to make animal.getScientificName as Italics(code below). I\'m using a List View and setting the text in the listview. I wan\'t only part of the Text view to

3条回答
  •  感动是毒
    2021-01-22 12:15

    use Html.fromHtml:

    listNames[ i ] = animal.getName().toUpperCase().replaceAll( "_" , " " ) + " \n\n" + "+animal.getScientificName()+"; 
    
    
    array_sort = new ArrayList( Arrays.asList( listNames) ); 
    tv.setText(Html.fromHtml(array_sort.get( position ) ));
    

    for more info, refer this

提交回复
热议问题