0

I want to disable the text selection effect (the popup tool for copy/paste/select-all on Andorid) on some DOM elements of a phonegap web app. Mostly, I want to enable text selection in textarea and input.

edit -- Not only text controls, but also div with 'editable' class name are expected to allow text selection.

I read a solution that totally disable text selection at disabling-text-selection-in-phonegap. How can I just disable it for elements besides textarea and input?

Community
  • 1
  • 1
mrmoment
  • 727
  • 2
  • 10
  • 34

1 Answers1

1

You could use as such,

public class MainActivity extends DroidGap {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        super.loadUrl("file:///android_asset/www/index.html");

        super.appView.setOnLongClickListener(new View.OnLongClickListener() {

            public boolean onLongClick(View v) {
                if(!(v instanceof TextView)) {
                    return true;
                }
            }
        });
    }
}

Hope this helps you.

Ashis Kumar
  • 6,494
  • 2
  • 21
  • 36