android:textIsSelectable in Webview

Asked

Viewed 189 times

0

I’m creating an app, and I wanted to leave hide the option to select the text and copy.

You know when people say focus above the text and appears that option to copy or share the text, I wanted to remove it.

Webview;

<WebView
    android:id="@+id/webView_des"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="5dp"
    />

Code that catches the body in the form of string;

String mimeType = "text/html; charset=UTF-8";
            String encoding = "utf-8";
            String htmlText = allArrayNewsDes[position];

            String text = "<html><head>"
                    + "<style type=\"text/css\">body{color: #525252;}"
                    + "</style></head>"
                    + "<body>"                          
                    +  htmlText
                    + "</body></html>";

            webnewsdes.loadData(text, mimeType, encoding);

I’ve tried everything but no success.

Like this here, I want to remove from Webview;

inserir a descrição da imagem aqui

1 answer

0


Add a Onlongclicklistener to Webview and make the method onLongClick() return true.

webnewsdes.setOnLongClickListener(new View.OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
        return true;
    }
});
  • Thank you very much :), saved me!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.