“requestLayout() improperly called by…” error on Android 4.3

前端 未结 5 2294
一个人的身影
一个人的身影 2020-12-30 21:57

I have a simple Custom TextView that sets custom font in its constructor like the code below

public class MyTextView extends TextView {

    @Inject CustomTy         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 22:34

    I met the same problem. That's because I was trying to set a view's position in the iOS way. You know in iOS set a view's position by set the view's left top value and width, height. But in Android, it should be (left, top, right, bottom). I did pay much attention on this. When I jump into the layout() definition, I read the method's comment, then I find out why the warning happened.

提交回复
热议问题