Android OS bug with some devices running Jelly Bean/4.2.1 - TextView.setError(CharSequence error) Missing icon

后端 未结 2 759
轻奢々
轻奢々 2021-01-31 15:51

Some, but not all, devices running Jelly Bean (4.2.1) appear to be missing the exclamation point error icon that should appear on a TextView (or, more commonly, an

2条回答
  •  感情败类
    2021-01-31 16:44

    I know there is a solution already here. Its just i try to avoid reflection at all costs on Android. If your ok with reflection go for it but try out my solution below first as it might fix the issue without having to subclass and reflect.

    Drawable d= getResources().getDrawable(R.drawable.ic_launcher);
                d.setBounds(0, 0, 
                        d.getIntrinsicWidth(), d.getIntrinsicHeight());
    
                et.setError("my error",d);
    

提交回复
热议问题