TextView的在人物方面的设定宽度 [英] Set width of TextView in terms of characters

查看:157
本文介绍了TextView的在人物方面的设定宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

真的找一个<一个href="http://stackoverflow.com/questions/3188719/how-can-i-set-a-minimum-width-in-characters-for-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.

这篇关于TextView的在人物方面的设定宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆