我有一个简单的自定义TextView,在其构造函数中设置自定义字体,如下面的代码
public class MyTextView extends TextView {
@Inject CustomTypeface customTypeface;
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
RoboGuice.injectMembers(context, this);
setTypeface(customTypeface.getTypeface(context, attrs));
setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
}
Run Code Online (Sandbox Code Playgroud)
从Gingerbread到JB 4.2都可以正常工作.但是当我在Android 4.3手机上显示自定义textview时,adb logcat充斥着以下消息.
10-05 16:09:15.225: WARN/View(9864): requestLayout() improperly called by com.cmp.views.MyTextView{42441b00 V.ED.... ......ID 18,218-456,270 #7f060085 app:id/summary} during layout: running second layout pass
10-05 16:09:15.225: WARN/View(9864): requestLayout() improperly called by com.cmp.views.MyTextView{423753d0 V.ED.... ......ID 26,176-742,278 #7f060085 app:id/summary} during layout: running second layout pass
Run Code Online (Sandbox Code Playgroud)
我注意到,它确实减慢了UI的速度.有什么想法为什么会在4.3上发生?
感谢您的帮助.