1 android widget textview remoteview xamarin
此问题与C#
使用编写的 Android 小部件有关Xamarin
。
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");
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能设置text style
为bold
?
提前致谢!
我不了解 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);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1477 次 |
最近记录: |