以下のコードのように、コンストラクターにカスタムフォントを設定する単純なカスタム 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);
}
}
Gingerbread から JB 4.2 まで正常に動作します。しかし、Android 4.3 フォンでカスタム テキストビューを表示すると、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
UI が少し遅くなることに気付きました。4.3 でなぜそれが起こっているのか、何か考えはありますか?
あなたの助けに感謝。