U can use TextPaint class ,and the method in this class is measureText, then
get one char width!
Any question u can post topic in http://androidos.cc/bbs,
、

你可以使用 TextPaint 类中的 measureText方法来测量单个字符的宽度!
如果有问题,可以在http://androidos.cc/bbs上发帖,我将第一时间回复你!



2009/1/6 Xiongzh <zx.zhangxi...@gmail.com>

>
> Hi all,
>
> I'll like to know how to calculate the actual pixels a text occupies
> in the screen from its font size.
>
> Say, my font size of the text in TextView is 20.5px.
> It doesn't mean that every character of the text occupies 20.5px in
> the screen, does it?
>
> I'm inheriting android.widget.TextView to implement a TextView which
> text can be scrolled automatically. Just as the behavior of the HTML
> <marquee/>.
>
> I need to know the actual pixels the text occupied to determine how
> far I shall scroll the text.
> However the getTextSize() * getText().length() is much longer than the
> actual length of the text, so I can't make the text re-displayed on
> time.
>
> Thank you in advance for helping me.
>
> BR
> xion...@beijing, China
>
> dirtybea...@hotmail.com
> >
>


-- 
Welcome to my site about GPhone:
http://51gphone.cn
I am a GFans!!欢迎你来到我的GPhone网站!!http://51gphone.cn

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to