Created
          February 6, 2015 13:05 
        
      - 
      
- 
        Save alorma/acde0c7d1741fbec34df to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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