I have an editText that triggers the regular android context menu to fire up on long press. The talkback focus though doesn't go to the context menu directly but instead goes through other focusable elements first before focusing on the context menu. Basically is there a way to access the default context menu (marked as 2) in android and give focus to it first after long press instead of talkback moving to other elements (marked as 1)?
sample SS
Related
I can setup the context menu of EditText when it is not in fullscreen with setCustomInsertionActionModeCallback and setCustomSelectionActionModeCallback methods but they don't do anything to setup the context menu when the EditText is in fullscreen (i.e. it remains default), and there seems to be no obvious way to do that.
Thus my question is: how to set the context menu of fullscreen EditText?
I have a EditText in my activity. I want that when the user finish the text, he can move to the next activity without press back button to hide the keyboard. I was wondering if there a way to put a button on softkeyboard to move to next activity.
(Sorry for bad english, its not my native language)
You can't add buttons to an existing keyboard. However, you can suggest a label and id for the custom IME action. See TextView.setImeActionLabel:
Change the custom IME action associated with the text view, which will be reported to an IME with actionLabel and actionId when it has focus.
You'll then have to call TextView.setOnEditorActionListener to provide a custom listener to listen for that IME event where you can then move to your next activity.
I'm having trouble with making custom EditText component. I want copy/paste/select all feature to be fully prevented.
Long click case is easy to prevent.
But there are 2 cases I've also seen which opens the menu and I'm having troubles with.
Double tap EditText (can be blocked for example to eat douple tap event)
But this removes the selection mode feature.
Some devices launch the menu when just clicking insert controller.
So I want to have insertion and selection controllers visible and usable, but the HandleView menu to be never shown.
Do I have to copy paste and override TextView class or is there simplier hack solution for this.
Br,
Niko
When I inserted code to display a context menu it worked fine except that the menu appeared not only after a stationary long press but also (unwanted) at the end of a drag.
I have been able to prevent this by: adding a ScrollInProgress flag to the View, by checking this flag at the beginning of the onCreateContextMenu(...) method, and if the flag is set by by-passing the code which adds items to the context menu.
However, I wonder if there is a simpler way of preventing the creation of a context menu when the screen is dragged.
To clarify, it isn't the gesture detector that's picking up the long press?
If it is, this can be disabled using setIsLongpressEnabled(boolean isLongpressEnabled)
I have a context menu on a TextView representing a user name in my app. When the context menu appears I want to have certain options such as View Statistics etc. The context menu is appearing fine and everything is working great except it's adding Input method to the context menu and I do not want it there. It's irrelevant to what the context menu is there for and there is not text entry. How can I remove this item from the context menu? I've tried removing item 0 in the context menu and adding
android:editable="false"
to the XML file to no avail. Any ideas?
How about menu.removeItem(android.R.id.switchInputMethod);?
Im pretty sure that isn't possible, the input method is how the user changes the current IME (soft keyboard) if the have multiple keyboards installed. Its a global setting.