Partager via


TextView.SetError Method

Definition

Overloads

SetError(ICharSequence, Drawable)

Sets the right-hand compound drawable of the TextView to the specified icon and sets an error message that will be displayed in a popup when the TextView has focus.

SetError(String, Drawable)

Sets the right-hand compound drawable of the TextView to the specified icon and sets an error message that will be displayed in a popup when the TextView has focus.

SetError(ICharSequence, Drawable)

Sets the right-hand compound drawable of the TextView to the specified icon and sets an error message that will be displayed in a popup when the TextView has focus.

[Android.Runtime.Register("setError", "(Ljava/lang/CharSequence;Landroid/graphics/drawable/Drawable;)V", "GetSetError_Ljava_lang_CharSequence_Landroid_graphics_drawable_Drawable_Handler")]
public virtual void SetError (Java.Lang.ICharSequence? error, Android.Graphics.Drawables.Drawable? icon);
[<Android.Runtime.Register("setError", "(Ljava/lang/CharSequence;Landroid/graphics/drawable/Drawable;)V", "GetSetError_Ljava_lang_CharSequence_Landroid_graphics_drawable_Drawable_Handler")>]
abstract member SetError : Java.Lang.ICharSequence * Android.Graphics.Drawables.Drawable -> unit
override this.SetError : Java.Lang.ICharSequence * Android.Graphics.Drawables.Drawable -> unit

Parameters

icon
Drawable
Attributes

Remarks

Sets the right-hand compound drawable of the TextView to the specified icon and sets an error message that will be displayed in a popup when the TextView has focus. The icon and error message will be reset to null when any key events cause changes to the TextView's text. The drawable must already have had Drawable#setBounds set on it. If the error is null, the error message will be cleared (and you should provide a null icon as well).

Java documentation for android.widget.TextView.setError(java.lang.CharSequence, android.graphics.drawable.Drawable).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetError(String, Drawable)

Sets the right-hand compound drawable of the TextView to the specified icon and sets an error message that will be displayed in a popup when the TextView has focus.

public void SetError (string? error, Android.Graphics.Drawables.Drawable? icon);
member this.SetError : string * Android.Graphics.Drawables.Drawable -> unit

Parameters

error
String
icon
Drawable

Remarks

Sets the right-hand compound drawable of the TextView to the specified icon and sets an error message that will be displayed in a popup when the TextView has focus. The icon and error message will be reset to null when any key events cause changes to the TextView's text. The drawable must already have had Drawable#setBounds set on it. If the error is null, the error message will be cleared (and you should provide a null icon as well).

Java documentation for android.widget.TextView.setError(java.lang.CharSequence, android.graphics.drawable.Drawable).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to