How Can I to Change Text Size in RemoteViews
Asked Answered
N

1

10

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?

Nancynandor answered 17/7, 2011 at 2:44 Comment(0)
C
30

How about the setFloat() method?

rv.setFloat(R.id.widget_item, "setTextSize", mPrefs.getTextsize().getValue());
Cacophonous answered 17/7, 2011 at 4:21 Comment(1)
Since API level 16 there's a setTextViewTextSize(R.id.x, TypedValue.COMPLEX_UNIT_SP, 12)Thrawn

© 2022 - 2024 — McMap. All rights reserved.