TextView的在人物方面的设定宽度宽度、方面、人物、TextView

由网友(毁灭自我.)分享简介:真的找一个answer这。想设置基于一个数字或字符一个TextView的宽度。所以,如果我希望它永远是3个字符宽,我可以设置并调整基础上,TEXTSIZE设置。不这样做,我必须的宽度设定为50dip或东西,其中根据字体大小可以或不可以是正确的。 Want to set the width of a TextView...

真的找一个answer这。

想设置基于一个数字或字符一个TextView的宽度。所以,如果我希望它永远是3个字符宽,我可以设置并调整基础上,TEXTSIZE设置。不这样做,我必须的宽度设定为50dip或东西,其中根据字体大小可以或不可以是正确的。

Want to set the width of a TextView based on a number or characters. So if I want it to always be 3 characters wide, I could set that and it will adjust based on the textSize setting. Without this, I have to set a width to 50dip or something, which may or may not be right depending on the font size.

推荐答案

回答我的问题...

和获奖者是:设置 minEms 属性(安卓minEms )!

And the winner is: set the minEms attribute (android:minEms) !!!

因此​​, EMS 的原来是指最宽字符的大小,典型地为 M,明白了吗?因此,设置minEms为整数值表示3,在一个EditText和TextView中应确保它至少3个字符宽。您可以设置maxEms为好。

So "ems" it turns out refers to the size of the widest character, typically an "M", get it? So setting minEms to an integer value say 3, on an EditText or TextView should ensure it's at least 3 characters wide. You can set the maxEms as well.

因此​​,在这个线程凯尔的回答,虽然错了,使我找到了答案,十分感谢凯尔。

So Kyle's answer on this thread, although wrong, caused me to find the answer, so thanks Kyle.

阅读全文

相关推荐

最新文章