有TextView的扩展其字体大小,以填补父? [英] Have TextView scale its font size to fill parent?

查看:171
本文介绍了有TextView的扩展其字体大小,以填补父?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让一个TextView选择一个字体大小,使其充满无论空间有可用?例如:

Is there a way to have a TextView pick a font size such that it fills whatever space it has available? For example:

<LinearLayout
  layout_width="fill_parent"
  layout_height="50dip" >

  <TextView
    layout_width="fill_parent"
    layout_height="fill_parent"
    textSize="scale?" />

</LinearLayout>

感谢

推荐答案

没有,有没有内置的字体缩放在的TextView 。你可以在的TextView 的子重载的OnDraw()的方法,但的TextView 不支持自动缩放文本。

No, there is not built in font scaling in a TextView. You could overload the onDraw() method in a child of TextView, but TextView does not support scaling the text automatically.

看看这个其他的<一个href="http://stackoverflow.com/questions/2596452/android-how-to-scale-resize-text-to-fit-a-textview">question.

这篇关于有TextView的扩展其字体大小,以填补父?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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