如何在应用程序| Android Studio的TextView中启用复制和粘贴选项

如何在应用程序| Android Studio的TextView中启用复制和粘贴选项,android,android-layout,android-studio,textview,android-studio-2.3,Android,Android Layout,Android Studio,Textview,Android Studio 2.3,因此,我想在我的静态android应用程序中启用复制和粘贴选项,我尝试了各种方法来启用复制粘贴选项,但每次添加代码时,它都会在我的整个代码中给我错误和警告。谁能帮忙吗。有人能告诉我或编辑这些代码,以便在我的android应用程序中启用复制粘贴选项吗 Activity.xml文件 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.andr

因此,我想在我的静态android应用程序中启用
复制
粘贴
选项,我尝试了各种方法来启用复制粘贴选项,但每次添加代码时,它都会在我的整个代码中给我错误和警告。谁能帮忙吗。有人能告诉我或编辑这些代码,以便在我的android应用程序中启用复制粘贴选项吗

Activity.xml文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sample.youtuber.health.SecondActivity">


   <ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginLeft="19dp"
    android:layout_marginRight="19dp"
    android:layout_marginStart="19dp"
    android:layout_marginTop="18dp"
    >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">


<ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="200dp"
    tools:ignore="ContentDescription"
    android:src="@drawable/browse"
    android:scaleType="fitXY"
    />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:id="@+id/textview"
    android:text="@string/How_To_Browse_Deep_Web"
    android:textAlignment="center"
    android:layout_gravity="center"
    />
    </LinearLayout>
</ScrollView>


</RelativeLayout>

将此行添加到您的Textview

android:textIsSelectable="true"

将此行添加到文本视图中:

 android:longClickable="true"
 android:textIsSelectable="true"
在Java类中,编写这一行以编程方式进行设置

myTextView.setTextIsSelectable(true);

没用,试过了
myTextView.setTextIsSelectable(true);