[android-developers] Re: Different Font Size on a Button

2012-05-07 Thread x300
Thank you, again. Most of my high-cost performance-sensitive stuff are run by the Handler on threads other than the main UI thread, and when I asked about Traceview in the past, someone told me "it is no good handling threads but otherwise is a good debugging tool" so I dismissed it without trying

[android-developers] Re: Different Font Size on a Button

2012-05-07 Thread x300
Thanks for the comment. I agree. This is the reason why I liked Zsolt Vasvari's code, and I did not change the RelativeSizeSpan to AbsoluteSizeSpan. But you have to remember an absolute size in pixels can get bigger or smaller depending on the displayed screen's density (dpi), meaning AbsoluteSi

Re: [android-developers] Re: Different Font Size on a Button

2012-05-07 Thread Mark Murphy
On Sun, May 6, 2012 at 11:51 PM, x300 wrote: > If there is a collection of reference and comparisons on class/method > cost, (even a simple, but easy to use, list of execution cycles) or a > tool to let us compare them for different approaches for a task, it > would be a great help. Use Traceview

[android-developers] Re: Different Font Size on a Button

2012-05-07 Thread x300
Thanks! I do believe this kind of curiosity, or inquisitive mind, is behind every breakthroughs. I might as well test if 1. or, 2.SizeSpan executes faster. Hope applying after applying brings the size back to default, otherwise it may face a problem when that part of the code gets initialized/re

Re: [android-developers] Re: Different Font Size on a Button

2012-05-07 Thread Jason Teagle
i.e. using an html string like "199 km/h" seems to work, although you cannot specify the sizes exactly... Just a quick note, specifying big / small or similar is considered better than specific sizes in the world of accessibility since they refer to a size *relative* to the user's current def

[android-developers] Re: Different Font Size on a Button

2012-05-07 Thread al
Using spannables directly is certainly the better way to do it since the supported html tags apparently are not clearly specified as Mark already mentioned. However, out of curiosity, I looked at the source of Html.java. So, just for the sake of completeness: I found that apparently only suppo

[android-developers] Re: Different Font Size on a Button

2012-05-06 Thread x300
May be we should start a new thread on this, but if you have already started on it, I would like to request the inclusion of another topic where Android "should excel but does not", which is the area of optimization. Unlike in big server apps and utilities development, where robustness and product

[android-developers] Re: Different Font Size on a Button

2012-05-06 Thread x300
Thanks for the comment, Ibendlin. I do agree, and do subscribe, to "Less is more". As this is not an appropriate venue to discuss the development process of my app, let me just briefly outline how it went with regard to the button: 1. The elimination of "km/h" was considered and rejected as the

[android-developers] Re: Different Font Size on a Button

2012-05-06 Thread lbendlin
Now let me throw a spanner into your work. Do some UX testing (grab a few people that haven't seen the app before) and present them with either of two versions, one version with the big number and small "km/h" string, and the other version with just the number. You will find that your app doesn'

Re: [android-developers] Re: Different Font Size on a Button

2012-05-06 Thread Mark Murphy
On Sun, May 6, 2012 at 12:58 AM, x300 wrote: > I often get across your post as a solution to similar problems I'm > facing, and want you to know that your efforts are appreciated around > the globe (I am located in Tokyo). Thanks! > Why don't you write a book "Curious Coder's Guide to Dark Side

[android-developers] Re: Different Font Size on a Button

2012-05-06 Thread x300
It works! Thanks a lot for sharing your insight :) :) :)My code look as follows: private static final float SMALL_TEXT_RELATIVE_SIZE = 0.6f; public CharSequence setSpeedText(){ CharSequence text = "km/h"; SpannableStringBuilder smaller

[android-developers] Re: Different Font Size on a Button

2012-05-05 Thread Zsolt Vasvari
Here's the code I use to make an arbitrary CharSequence "smaller" private static final float SMALL_TEXT_RELATIVE_SIZE = 0.8f; public static CharSequence makeSmaller(CharSequence text) { SpannableStringBuilder smaller = new SpannableStringBuilder(text); smaller.setSpan(

[android-developers] Re: Different Font Size on a Button

2012-05-05 Thread x300
Thanks. I will play with SpannableString stuff with SizeSpan, and will post here if something works. I often get across your post as a solution to similar problems I'm facing, and want you to know that your efforts are appreciated around the globe (I am located in Tokyo). Why don't you write a bo

Re: [android-developers] Re: Different Font Size on a Button

2012-05-05 Thread Mark Murphy
On Sat, May 5, 2012 at 1:23 PM, x300 wrote: > Thank you very much for the response.  It almost worked. Almost who-hoo! :-) > Please check the following code if I implemented your method as you > intended: Yeah, you did, but Android messed me up. It can take a Spanned with font sizes and *gener

[android-developers] Re: Different Font Size on a Button

2012-05-05 Thread x300
Thank you very much for the response. It almost worked. Please check the following code if I implemented your method as you intended: public Spanned setSpeedText(){ StringBuilder hTmlSB = new StringBuilder() .append(