mrmoment
mrmoment

Reputation: 757

Disable partial text selection in phonegap web app (android)

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?

Upvotes: 0

Views: 767

Answers (1)

Ashis Kumar
Ashis Kumar

Reputation: 6544

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.

Upvotes: 1

Related Questions