Android setError(“error”) not working in Textview

前端 未结 4 380
醉酒成梦
醉酒成梦 2020-12-09 08:30

We can set error in Edittext successfully but failed to set in textview. is there any problem?? i tried

((TextView) findViewById(R.id.df)).requestFocus();
((         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 08:35

    Actually , you can use the setError for the textView and show its popup .

    You just need to use the same style as of the EditText .

    Simply add the next attribute for the textView in the xml :

    style="@android:style/Widget.EditText"
    

提交回复
热议问题