How Can I to Change Text Size in RemoteViews

﹥>﹥吖頭↗ 提交于 2019-11-29 13:56:13

问题


Under 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;
}

How can I change the text size programmatically?


回答1:


How about the setFloat() method?

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


来源:https://stackoverflow.com/questions/6721616/how-can-i-to-change-text-size-in-remoteviews

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!