background
i need to show amount of money in textView with SpannableString and then fit the font of the TextView to the boundaries given to it, as follows:
SpannableString Code:
String s= "2,000,000.000";
SpannableString ss1= new SpannableString(s);
ss1.setSpan(new RelativeSizeSpan(1.4f), 0,1, 0); // set size 2
ss1.setSpan(new RelativeSizeSpan(1.2f), 2,5, 0); // set size 000 (first)
ss1.setSpan(new RelativeSizeSpan(1.2f), 6,9, 0); // set size 000 (second)
ss1.setSpan(new RelativeSizeSpan(1f), 10,13, 0); // set size 000 (Third)
TextView tv= (TextView)findViewById(R.id.money);
tv.setText(ss1);
The problem
My problem is to fit the text size with screen width
I tried to use the solutions for these posts(here and here) but none of them not work well with SpannableString.
The question
Does anybody know of a solution for this problem?