假设我有这个:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setMessage("I want THIS word to be bold and the rest normal!")
.create().show();
有什么办法让Android将格式设置或粗体字体应用于部分文本字符串?
你可以像这样在你的strings.xml中添加一个字符串:
<string name="bold_message">I want <b>THIS</b> word to be bold and the rest normal!</string>
然后在警报对话框中使用 setMessage(R.string.bold_message)