Użyj SpannableString w widżetach na ekranie głównym Androida?
Mogę uzyćSpannableStrings
w textView widżetu? Próbowałem i wszystko, co renderowałem, było zwykłym tekstem. Nie wiem, czy to coś, co robię źle (najprawdopodobniej), czy z jakiegoś powodu nie jest to możliwe.
Oto kod, którego używam (naprawdę nic specjalnego ...)
public static void updateWidgetState(Context paramContext, String paramString, Integer appWidgetId) {
SpannableString majorLabel = new SpannableString("");
SpannableString minorLabel = new SpannableString("");
if (position > -1) {
majorLabel = GetParsedMajorLabel(paramContext);
minorLabel = GetParsedMinorLabel(paramContext);
}
RemoteViews localRemoteViews = buildUpdate(paramContext, paramString, appWidgetId);
localRemoteViews.setTextViewText(R.id.majorlabel, majorLabel);
localRemoteViews.setTextViewText(R.id.minorlabel, minorLabel);
}