Compartir a través de


TextView.SetTextIsSelectable(Boolean) Method

Definition

Sets whether the content of this view is selectable by the user.

[Android.Runtime.Register("setTextIsSelectable", "(Z)V", "GetSetTextIsSelectable_ZHandler")]
public virtual void SetTextIsSelectable (bool selectable);
[<Android.Runtime.Register("setTextIsSelectable", "(Z)V", "GetSetTextIsSelectable_ZHandler")>]
abstract member SetTextIsSelectable : bool -> unit
override this.SetTextIsSelectable : bool -> unit

Parameters

selectable
Boolean

Whether the content of this TextView should be selectable.

Attributes

Remarks

Sets whether the content of this view is selectable by the user. The default is false, meaning that the content is not selectable.

When you use a TextView to display a useful piece of information to the user (such as a contact's address), make it selectable, so that the user can select and copy its content. You can also use set the XML attribute android.R.styleable#TextView_textIsSelectable to "true".

When you call this method to set the value of textIsSelectable, it sets the flags focusable, focusableInTouchMode, clickable, and longClickable to the same value. These flags correspond to the attributes android.R.styleable#View_focusable android:focusable, android.R.styleable#View_focusableInTouchMode android:focusableInTouchMode, android.R.styleable#View_clickable android:clickable, and android.R.styleable#View_longClickable android:longClickable. To restore any of these flags to a state you had set previously, call one or more of the following methods: #setFocusable(boolean) setFocusable(), #setFocusableInTouchMode(boolean) setFocusableInTouchMode(), #setClickable(boolean) setClickable() or #setLongClickable(boolean) setLongClickable().

Java documentation for android.widget.TextView.setTextIsSelectable(boolean).

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