这个问题与一个使用Xamarin用C#编写的android小部件有关。
我想为我的小部件布局的一个元素将文本视图的text style设置为bold。更改文本本身效果很好,但我不能设置其他属性。
这是构建更新的方法的一部分
remoteViews.SetTextViewText(Resource.Id.widget_info, nextItemText[1]);
if (element.InProgress)
{
// this is my try to set textstyle to bold
remoteViews.SetString(Resource.Id.widget_info, "textStyle", "bold");
}如何将text style设置为bold
提前感谢!
发布于 2015-04-03 00:08:15
我不知道Xamarin/C#,但这就是你在Java中如何做到这一点,也许你可以适应它:
SpannableString s = new SpannableString("To boldly go where no man has gone before");
// make the word "boldly" be in bold
s.setSpan(new StyleSpan(Typeface.BOLD), 3, 9, 0);
remoteViews.setTextViewText(R.id.txt, s); https://stackoverflow.com/questions/26758192
复制相似问题