textselection

Is it possible to create a custom floating text selection menu in Android versions pre Marshmallow?

☆樱花仙子☆ 提交于 2019-12-04 10:05:12
I'm looking to create a custom menu for text selection. I know it's possible to edit the behaviour of the action bar with setCustomSelectionActionModeCallback, but in my case I don't want that action bar to show at all, I want my own floating custom menu which I have already achieved. Only thing is that there is no way to not show the action bar menu after selecting the text in the TextView. The behaviour I need is not the standard cut/copy/paste, the actions I have implemented are for highlighting and saving the highlighted section of text to a database. I have done some tinkering and the

Making a rectangular selection in a RichTextBox with Alt-Left-Mouse sweep?

牧云@^-^@ 提交于 2019-12-04 07:44:09
There are quite a few applications that allow you to select a box or rectangle of text by sweeping with mouse while the Alt key is pressed. Visual Studio 2010 does this in the code editor, for instance. Emacs does it. Winword does it. We've all seen it. It seems like there must be a standard pattern to follow to encode this behavior but I cannot seem to find it. I suspect I am not Googling with the correct keywords as all I am getting are false hits on rectangle, Alt-Left, sweep, selection, etc. I'm sure I can code it up but it would mean disabling the normal selection code used in, say,

android webview: prevent text selection actionMode actionBar

╄→гoц情女王★ 提交于 2019-12-04 05:37:58
I want to preserve the text selection in a webView while preventing any contextual menu of the actioMode from being shown. Neither the new floating one nor the old actionBar, just the selection handles and of course the selection behaviour. Hooking to the actionModeCallback in startActionMode allows me to clear all items in the menu in the callback onCreateActionMode. This works fine on android 6, since an empty floating menu won't show at all, and the actionMode text selection behaviour is preserved. Unfortunately on android < 6 this leaves an empty actionBar shown, how can I completely

How to clear the selection in an EditText?

守給你的承諾、 提交于 2019-12-04 04:10:46
How do you programmatically remove the selection from an EditText ? I've tried: myEditText.setSelection(selectionEnd); but that just creates a selection of 0 length at the end of the current selection. I've also tried Selection.removeSelection(mySpannable) , and it just puts an empty selection at the beginning of the text. Calling myEditText.clearFocus(); . I think that's what you need To move selection to top: edit_text.setSelection(0); To move selection to bottom: edit_text.setSelection(edit_text.getText().length()); EditText message = (EditText) findViewById(R.id.sendText); String text =

What Text Selection Control is this?

喜欢而已 提交于 2019-12-03 06:14:56
I want to implement the same nature type of control on text selection on a Activity with various text fields. Any ideas of implementing the behavior shown in Picture Refer this from the Android 2.3 Documentation: You can create your own Text Selection Control using this methods. 来源: https://stackoverflow.com/questions/4874266/what-text-selection-control-is-this

Why is .disableSelection() deprecated?

我怕爱的太早我们不能终老 提交于 2019-12-03 05:26:19
问题 .disableSelection in JQueryUI 1.9 is deprecated. The only explanation I can find is, literally, "Disabling text selection is bad. Don't use this." and "We shouldn't allow developers to mess with text selection. This was originally for the interaction plugins, but they're all handling text selection properly on their own at this point." Since there is no alternative suggested, I assume they mean that it is always bad but I cannot fathom their reasons. A double/triple-click or otherwise

Why is .disableSelection() deprecated?

让人想犯罪 __ 提交于 2019-12-02 19:54:21
.disableSelection in JQueryUI 1.9 is deprecated. The only explanation I can find is, literally, "Disabling text selection is bad. Don't use this." and "We shouldn't allow developers to mess with text selection. This was originally for the interaction plugins, but they're all handling text selection properly on their own at this point." Since there is no alternative suggested, I assume they mean that it is always bad but I cannot fathom their reasons. A double/triple-click or otherwise meaningless selection of an elaborate-UI application improperly applies the text-highlight effect and (to me)

Why getting a text selection from textarea works when a button clicked but not when a “div” clicked (in Internet Explorer)

梦想与她 提交于 2019-12-02 04:21:23
Consider the following code: ( Live demo here - Open in Internet Explorer 7 or 9 ) HTML: <textarea>Hello Stack Overflow</textarea> <input class="a" type="button" value="Click here does the job" /> <div class="a">But clicking here not :(</div> JS: function getInputSelection(el) { var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange; if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { start = el.selectionStart; end = el.selectionEnd; } else { range = document.selection.createRange(); if (range && range.parentElement() == el) { len = el.value

Making text unselectable [duplicate]

旧城冷巷雨未停 提交于 2019-12-01 15:09:12
This question already has an answer here: How to disable text selection highlighting 42 answers So, while playing with scrollbars and stuff in HTML5, I'm starting to notice an annoying trend. If I have text near my element that's being dragged (say, a scrub bar for a video, scroll bar, anything a user would click and drag), nearby text will get selected, as if I'm not using a control, just dragging over the page. This is terribly annoying, and I can't seem to find the right string to search for on google to figure out if it's possible to make certain elements "unselectable". Anyone know how to

Making text unselectable [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-01 14:46:52
问题 This question already has answers here : How to disable text selection highlighting (43 answers) Closed 2 years ago . So, while playing with scrollbars and stuff in HTML5, I'm starting to notice an annoying trend. If I have text near my element that's being dragged (say, a scrub bar for a video, scroll bar, anything a user would click and drag), nearby text will get selected, as if I'm not using a control, just dragging over the page. This is terribly annoying, and I can't seem to find the