这不是String array text formatting的重复。我查看了该问题的答案,但不适用于我。我的代码是:
description = (TextView)findViewById(R.id.description);
String [] item = {"BBQ Steak \n \n marinated BBQ Steak \n \n Regular Medium Large \n \n sh 500 sh 700 sh 900","Chicken BBQ bacon \n \n BBQ Chicken,Bacon,Sweet Corn,Onion \n \n Regular Medium Large \n \n sh 500 sh 700 sh 900 ","Chicken and Mushroom \n \n chicken,mushroom \n \n Regular Medium Large \n \n sh500 sh700 sh900","Chicken tikka \n \n marinated tikka chicken, green pepper, onion \n \n Regular Medium Large \n \n sh 500 sh 700 sh 900","Stack it up(large) \n \n Double stack ANY LARGE PIZZA \n \n chicken,mushroom,creamy,tomato mayo,mozzarella cheese \n \n sh 150 extra "}
description.setText(item[x]);
我使用此数组存储特定比萨饼的描述,当用户选择它时将显示这些比萨饼。比萨饼存储在列表项中。但是我想将格式样式应用于数组中的信息,例如像Regular这样的单词上的粗体,但是在所有披萨描述中都没有使用单词Regular。使用Spannable String很困难,因为我有大量的text.And我也想使用不同的字体样式。但主要是大胆和下划线样式。任何帮助将受到高度赞赏。