我想知道是否可以添加一些样式到列表视图中使用的字符串?我已经尝试使用转义码的HTML格式,我似乎得到的是代码显示,但实际上并没有做我想做的事情。我想让LISTVIEW中的字符串变粗体,然后换行不粗体,如果可能的话使用更小的字体。我目前有BOLD代码,但似乎也没有做任何事情,它不会给我任何格式错误。Android ListView字符串样式
ListView menuList = (ListView) findViewById(R.id.ListView_Menu);
String[] items =
{
getResources().getString(R.string.menu_item_one),
getResources().getString(R.string.menu_item_two),
getResources().getString(R.string.menu_item_three),
getResources().getString(R.string.menu_item_four),
getResources().getString(R.string.menu_item_five),
getResources().getString(R.string.menu_method_six),
};
ArrayAdapter<String> adapt = new ArrayAdapter<String>(this,
R.layout.menu_item, items);
menuList.setAdapter(adapt);
琴弦这个样子
<string name="menu_item_one"><b>This should be BOLD</b>\nSshould should not be be bold and smaller font if possible</string>
<string name="menu_item_two"><b>This should be BOLD</b>\nSshould should not be be bold and smaller font if possible</string>
<string name="menu_item_three"><b>This should be BOLD</b>\nSshould should not be be bold and smaller font if possible</string>
<string name="menu_item_four"><b>This should be BOLD</b>\nSshould should not be be bold and smaller font if possible</string>
<string name="menu_item_five"><b>This should be BOLD</b>\nSshould should not be be bold and smaller font if possible</string>
<string name="menu_item_six"><b>This should be BOLD</b>\nSshould should not be be bold and smaller font if possible</string>
请在提出问题时不要放弃。这让他们更难阅读,并且不会更快地得到答案。这也是非常烦人的,并且意味着有人必须编辑您的帖子以将其删除。此外,请在发布它时检查问题下方显示的预览,以检查代码格式等内容。谢谢。 –