Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.RelativeSizeSpan;
import android.text.style.SuperscriptSpan;
/**
* Created by a557114 on 02/02/2015.
*/
public class MoneyUtils {
public static SpannableString format(float amout) {
String price = Float.toString(amout) + "";
SpannableString spPrice = new SpannableString(price);
int start = price.indexOf("");
spPrice.setSpan(new SuperscriptSpan(), start, start + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spPrice.setSpan(new RelativeSizeSpan(0.60f), start, start + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return spPrice;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment