Maj*_*odi 6 fonts android widget
我想更改我的小部件中的字体,以便它使用我的应用程序的"assets"文件夹中的特定字体.
我通常在我的应用程序中执行此操作来更改字体:
Typeface tf= Typeface.createFromAsset(getAssets(), "advertising.ttf");
TextView converted = (TextView)findViewById(R.id.TextView03);
converted.setTypeFace(tf);
Run Code Online (Sandbox Code Playgroud)
它就像一个魅力.
我怎么能在小部件中这样做?我只能设置文本并更改颜色:
remoteView.setTextViewText(R.id.TextView03,"some text" );
remoteView.setTextColor(R.id.TextView03, Color.BLACK);
Run Code Online (Sandbox Code Playgroud)
但我没有看到设置字体的方法.有什么帮助吗?
小智 4
也遇到了同样的问题,并发现:“因为小部件存在于其他进程中,所以它们只能使用系统字体,而不能使用包内部可能的其他字体。解决这个问题的一种方法是将字体渲染到位图在您的进程中,然后将其推送到 RemoteViews。” Jeff Sharkey 在此发布: http://www.mailinglistarchive.com/html/android-developers@googlegroups.com/2009-06/msg00211.html
| 归档时间: |
|
| 查看次数: |
5208 次 |
| 最近记录: |