android.view.InflateException: Binary XML file line #12: Error inflating class

后端 未结 30 2458
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 13:48

I am receiving many errors of kind displayed in the subj. These errors seems to be occasional and I cannot reproduce them. From stack I can learn that such error may occurs

30条回答
  •  天命终不由人
    2020-11-22 14:45

    I had the same error when creating custom view with only one constructor, try to define all constructor for your custom views.

       public CustomWebView(Context context) {
            super(context);
            init();
        }
    
        public CustomWebView(Context context, AttributeSet attrs) {
            super(context, attrs);
            init();
        }
    
        public CustomWebView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
            init();
        }
    

提交回复
热议问题