Method 1
public static void increaseFontSizeForPath(Spannable spannable, String path, float increaseTime) { int startIndexOfPath = spannable.toString().indexOf(path); spannable.setSpan(new RelativeSizeSpan(increaseTime), startIndexOfPath, startIndexOfPath + path.length(), 0); }
using
Utils.increaseFontSizeForPath(spannable, "big", 3); // make "big" text bigger 3 time than normal text

Method 2
public static void setFontSizeForPath(Spannable spannable, String path, int fontSizeInPixel) { int startIndexOfPath = spannable.toString().indexOf(path); spannable.setSpan(new AbsoluteSizeSpan(fontSizeInPixel), startIndexOfPath, startIndexOfPath + path.length(), 0); }
using
Utils.setFontSizeForPath(spannable, "big", (int) textView.getTextSize() + 20);

Phan Van Linh Nov 17 '17 at 2:09 on 2017-11-17 02:09
source share