Android EditText.setError not working in not customizable

How can I display a text error using setError in an EditText that is not customizable? It is important that users do not change this EditText, it will change for the application. Maybe I have another option other than focusable = false?

Now I have this:

<EditText
    android:id="@+id/date"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:ems="10"
    android:focusable="false"
    android:inputType="text"
    android:onClick="onClick" />

      

Thank you so much!

+3


source to share


2 answers


Finally, I think it is impossible to do this ... Since the first need is to block the text, doing it with focusable = false or with a TextView and also blocking the setError functionality.

Editing text with focusable = false I can get correct drawing (default red exclamation mark) but no text. For this reason, I finally added some text using Toast.



This is not completely what I wanted, but it is the most similar.

Thank you for your help!

+1


source


Just use a TextView and if you have an error somewhere then show the image with drawableRight. Here's a programming example: fooobar.com/questions/433440 / ...



0


source







All Articles