如何在RemoteViews中更改文本大小

时间:2011-07-17 02:44:54

标签: android android-widget text-size remoteview

在RemoteViewsService.RemoteViewsFactory

public RemoteViews getViewAt(int position) {
    final int itemId = (position % 2 == 0 ? R.layout.light_widget_item
            : R.layout.dark_widget_item);
    RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId);
    rv.setTextViewText(R.id.widget_item, text);
    // rv.setTextSize(mPrefs.getTextsize().getValue());
    return rv;
}

如何以编程方式更改文字大小?

1 个答案:

答案 0 :(得分:29)

setFloat()方法怎么样?

rv.setFloat(R.id.widget_item, "setTextSize", mPrefs.getTextsize().getValue());