sHa*_*hid 3 android progressdialog textview
我有一个进度对话框,我想显示如下文本消息
我可以将“1. 正在下载”显示为绿色,将“2. 解压缩”显示为红色。我的代码在哪里
mProgressDialog.setMessage("1. Downloading \n 2. Decompressing");
Run Code Online (Sandbox Code Playgroud)
看看这段代码。
final SpannableStringBuilder sb = new SpannableStringBuilder("your text here");
final ForegroundColorSpan fcs = new ForegroundColorSpan(Color.rgb(158, 158, 158));
// Span to set text color to some RGB value
final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD);
// Span to make text bold
sb.setSpan(fcs, 0, 4, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
// Set the text color for first 4 characters
sb.setSpan(bss, 0, 4, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
// make them also bold
yourTextView.setText(sb);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1484 次 |
| 最近记录: |