我正在使用我在这里找到的类AutoResizeTextView:https://stackoverflow.com/a/5535672/371778
直到JellyBean为止,这一直很好。似乎JellyBean无法从textView AttributeSet中识别出getTextSize(),因为它返回0.0。
我尝试制作自定义xml属性,但是我使用样式来使用AutoResizeTextView类,并且不能在styles.xml中包含自定义 namespace 。
想办法让JellyBean识别此方法吗?
最佳答案
我遇到了同样的问题,我只是通过AutoResizeTextView类中的修复程序解决了它
/**
* When text changes, set the force resize flag to true and reset the text size.
*/
@Override
protected void onTextChanged(final CharSequence text, final int start, final int before, final int after)
{
mNeedsResize = true;
mTextSize = getTextSize(); // I ADDED THIS
// Since this view may be reused, it is good to reset the text size
resetTextSize();
}
现在它可以在2.3、4.0和4.1上运行。
p.f.
关于Android JellyBean无法识别AttriubteSet的getTextSize,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11522676/