如何使文字加粗的一部分,从机器人的ArrayList [英] How to make a part of text bold from arraylist in android
本文介绍了如何使文字加粗的一部分,从机器人的ArrayList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Android应用程序,我从MySQL数据库检索数据,它们存储在ArrayList和在ListView显示它们。现在,我想打一个perticular字符串大胆,即,如果在我的ArrayList中,有数据类似,我:你好..,然后在列表视图它应该显示我:你好..。这里的我:将在列表中的第一个字符串,但在哪一行都不知道。我没有得到的想法如何做到这一点。请帮助我的人.. !!
In my android app, I am retrieving data from mysql database, storing them in arraylist and displaying them in a listview. Now I want to make a perticular String bold, i.e. if in my arraylist, there's data something like, "Me: hello.." then in listview it should display as " Me: hello.. " . Here "Me:" will be first string in list but don't know in which row. I am not getting idea how to do this. Please someone help me..!!
推荐答案
尝试下面code:
if(array.get(i).contain("Me")){
String value = array.get(i).split(":")[0];
String value1 = array.get(i).split(":")[1];
String main_value = "<b>"+value +":</b> "+ value1;
txt.setText( Html.fromHtml(main_value));
}
这篇关于如何使文字加粗的一部分,从机器人的ArrayList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文