自动缩放TextView的文本中边界适合在4.0 [英] Auto Scale TextView Text to Fit within Bounds in 4.0

查看:161
本文介绍了自动缩放TextView的文本中边界适合在4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大通给了这个问题的解决方案是在2.2做工精细 - 3.2,但是当我测试了4.0失败

The solution Chase gave for this problem was working fine in 2.2 - 3.2 but when I tested it on 4.0 it failed.

下面是原帖:

自动缩放TextView的文本中边界适合

在4.0我得到这使我的东西,他/她在他/她的code写了一个奇怪的行间距的问题:

On 4.0 I get a strange line spacing problem which brings me to something he/she wrote in his/her code:

// Some devices try to auto adjust line spacing, so force default line spacing 
// and invalidate the layout as a side effect
   textPaint.setTextSize(targetTextSize);
   setLineSpacing(mSpacingAdd, mSpacingMult);

我想这是现​​在失败,我不知道为什么(人?)。也不知道为什么他/她写它摆在首位的是不是这取决于操作系统,而不是一个与设备相关的问题?

I guess this is failing now and I'm not sure why (anyone?). Also not sure why he/she wrote it in the first place as isn't this OS dependent and not a device dependent problem?

推荐答案

ICS有TextView的调整问题,即在某些条件下,将调整了,但不下来。这个魔法对我的作品。当您设置的TextView的文本,也执行此

ICS has TextView resizing issue where in some conditions it will resize up but not down. This black magic works for me. After you set the text of your TextView, also perform this

textView.append("\uFEFF");

这篇关于自动缩放TextView的文本中边界适合在4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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